diff --git a/dalmdl/corefdb/bucket.go b/dalmdl/corefdb/bucket.go index e56c54e7cbd06253fd3b653d3a14566e1de2bc9d..3b84a0b28231253ffddf510155fb593067895187 100644 --- a/dalmdl/corefdb/bucket.go +++ b/dalmdl/corefdb/bucket.go @@ -55,6 +55,8 @@ const ( IndexKeyValSeperator = "=" // FileType - represents key for type of file. Used whenever we need to set file type field in json 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. @@ -848,6 +850,10 @@ func updateDataWithInFileIndex(filePath string, bucket *Bucket, rs *gjson.Result indexRows := gjson.Parse(indexDataString) indexRecordsToUpdate := indexRows for _, query := range infileIndexQueries { + if query == GetAll { + // return all results + break + } indexRecordsToUpdate = indexRecordsToUpdate.Get(query + "#") } loggermdl.LogError("indexRecordsToUpdate - ", indexRecordsToUpdate) @@ -1265,6 +1271,10 @@ func getFileDataUsingInFileIndex(filePath string, bucket *Bucket, requestedFileT indexData := gjson.Parse(indexDataString) indexRows := indexData.Get(`#[fileType==` + requestedFileType + `]#`) for i := 0; i < len(inFileIndexQuery); i++ { + if inFileIndexQuery[i] == GetAll { + // return all results + break + } indexRows = indexRows.Get(inFileIndexQuery[i] + "#") } sb := strings.Builder{} @@ -1784,6 +1794,10 @@ func ReadDataFromFDB(dbName, indexID string, rs *gjson.Result, query []string, i rsJSON := gjson.Parse("[" + value + "]") for i := 0; i < len(query); i++ { loggermdl.LogError(query[i]) + if query[i] == GetAll { + // return all results + break + } rsJSON = rsJSON.Get(query[i] + "#") } if rsJSON.Value() != nil { @@ -1867,6 +1881,10 @@ func UpdateDataInFDB(dbName, indexID string, rs *gjson.Result, query []string, i loggermdl.LogError("key = ", key, " val = ", value) rsJSON := gjson.Parse("[" + value + "]") for i := 0; i < len(query); i++ { + if query[i] == GetAll { + // return all results + break + } rsJSON = rsJSON.Get(query[i] + "#") } if rsJSON.Value() != nil {