Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
MKCLOS
Core Development Platform
corepkgv2
Commits
a39d32d7
Commit
a39d32d7
authored
5 years ago
by
Akshay Bharambe
Browse files
Options
Downloads
Patches
Plain Diff
Add: FDB query to fetch all data
1. Add: FDB query to fetch all data
parent
ff2d11ad
Branches
Branches containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dalmdl/corefdb/bucket.go
+18
-0
dalmdl/corefdb/bucket.go
with
18 additions
and
0 deletions
dalmdl/corefdb/bucket.go
+
18
−
0
View file @
a39d32d7
...
@@ -55,6 +55,8 @@ const (
...
@@ -55,6 +55,8 @@ const (
IndexKeyValSeperator
=
"="
IndexKeyValSeperator
=
"="
// FileType - represents key for type of file. Used whenever we need to set file type field in json
// FileType - represents key for type of file. Used whenever we need to set file type field in json
FileType
=
"fileType"
FileType
=
"fileType"
// GetAll - wraper gjson query to return all results.
GetAll
=
"#[*]"
)
)
// ErrNoDataFound - This error describes that the required data might be deleted and not found. Kidly ignore this error in caller.
// ErrNoDataFound - This error describes that the required data might be deleted and not found. Kidly ignore this error in caller.
...
@@ -848,6 +850,10 @@ func updateDataWithInFileIndex(filePath string, bucket *Bucket, rs *gjson.Result
...
@@ -848,6 +850,10 @@ func updateDataWithInFileIndex(filePath string, bucket *Bucket, rs *gjson.Result
indexRows
:=
gjson
.
Parse
(
indexDataString
)
indexRows
:=
gjson
.
Parse
(
indexDataString
)
indexRecordsToUpdate
:=
indexRows
indexRecordsToUpdate
:=
indexRows
for
_
,
query
:=
range
infileIndexQueries
{
for
_
,
query
:=
range
infileIndexQueries
{
if
query
==
GetAll
{
// return all results
break
}
indexRecordsToUpdate
=
indexRecordsToUpdate
.
Get
(
query
+
"#"
)
indexRecordsToUpdate
=
indexRecordsToUpdate
.
Get
(
query
+
"#"
)
}
}
loggermdl
.
LogError
(
"indexRecordsToUpdate - "
,
indexRecordsToUpdate
)
loggermdl
.
LogError
(
"indexRecordsToUpdate - "
,
indexRecordsToUpdate
)
...
@@ -1265,6 +1271,10 @@ func getFileDataUsingInFileIndex(filePath string, bucket *Bucket, requestedFileT
...
@@ -1265,6 +1271,10 @@ func getFileDataUsingInFileIndex(filePath string, bucket *Bucket, requestedFileT
indexData
:=
gjson
.
Parse
(
indexDataString
)
indexData
:=
gjson
.
Parse
(
indexDataString
)
indexRows
:=
indexData
.
Get
(
`#[fileType==`
+
requestedFileType
+
`]#`
)
indexRows
:=
indexData
.
Get
(
`#[fileType==`
+
requestedFileType
+
`]#`
)
for
i
:=
0
;
i
<
len
(
inFileIndexQuery
);
i
++
{
for
i
:=
0
;
i
<
len
(
inFileIndexQuery
);
i
++
{
if
inFileIndexQuery
[
i
]
==
GetAll
{
// return all results
break
}
indexRows
=
indexRows
.
Get
(
inFileIndexQuery
[
i
]
+
"#"
)
indexRows
=
indexRows
.
Get
(
inFileIndexQuery
[
i
]
+
"#"
)
}
}
sb
:=
strings
.
Builder
{}
sb
:=
strings
.
Builder
{}
...
@@ -1784,6 +1794,10 @@ func ReadDataFromFDB(dbName, indexID string, rs *gjson.Result, query []string, i
...
@@ -1784,6 +1794,10 @@ func ReadDataFromFDB(dbName, indexID string, rs *gjson.Result, query []string, i
rsJSON
:=
gjson
.
Parse
(
"["
+
value
+
"]"
)
rsJSON
:=
gjson
.
Parse
(
"["
+
value
+
"]"
)
for
i
:=
0
;
i
<
len
(
query
);
i
++
{
for
i
:=
0
;
i
<
len
(
query
);
i
++
{
loggermdl
.
LogError
(
query
[
i
])
loggermdl
.
LogError
(
query
[
i
])
if
query
[
i
]
==
GetAll
{
// return all results
break
}
rsJSON
=
rsJSON
.
Get
(
query
[
i
]
+
"#"
)
rsJSON
=
rsJSON
.
Get
(
query
[
i
]
+
"#"
)
}
}
if
rsJSON
.
Value
()
!=
nil
{
if
rsJSON
.
Value
()
!=
nil
{
...
@@ -1867,6 +1881,10 @@ func UpdateDataInFDB(dbName, indexID string, rs *gjson.Result, query []string, i
...
@@ -1867,6 +1881,10 @@ func UpdateDataInFDB(dbName, indexID string, rs *gjson.Result, query []string, i
loggermdl
.
LogError
(
"key = "
,
key
,
" val = "
,
value
)
loggermdl
.
LogError
(
"key = "
,
key
,
" val = "
,
value
)
rsJSON
:=
gjson
.
Parse
(
"["
+
value
+
"]"
)
rsJSON
:=
gjson
.
Parse
(
"["
+
value
+
"]"
)
for
i
:=
0
;
i
<
len
(
query
);
i
++
{
for
i
:=
0
;
i
<
len
(
query
);
i
++
{
if
query
[
i
]
==
GetAll
{
// return all results
break
}
rsJSON
=
rsJSON
.
Get
(
query
[
i
]
+
"#"
)
rsJSON
=
rsJSON
.
Get
(
query
[
i
]
+
"#"
)
}
}
if
rsJSON
.
Value
()
!=
nil
{
if
rsJSON
.
Value
()
!=
nil
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets