MCPcopy Index your code
hub / github.com/upper/db / compileQuery

Method compileQuery

adapter/mongo/collection.go:214–236  ·  view source on GitHub ↗
(terms ...interface{})

Source from the content-addressed store, hash-verified

212}
213
214func (col *Collection) compileQuery(terms ...interface{}) interface{} {
215 compiled := col.compileConditions(terms)
216 if compiled == nil {
217 return nil
218 }
219
220 conditions := compiled.([]interface{})
221 if len(conditions) == 1 {
222 return conditions[0]
223 }
224 // this should be correct.
225 // query = map[string]interface{}{"$and": conditions}
226
227 // attempt to workaround https://jira.mongodb.org/browse/SERVER-4572
228 mapped := map[string]interface{}{}
229 for _, v := range conditions {
230 for kk := range v.(map[string]interface{}) {
231 mapped[kk] = v.(map[string]interface{})[kk]
232 }
233 }
234
235 return mapped
236}
237
238// Name returns the name of the table or tables that form the collection.
239func (col *Collection) Name() string {

Callers 3

FindMethod · 0.95
andMethod · 0.80
whereMethod · 0.80

Implementers 1

collectionWithSessioninternal/sqladapter/collection.go

Calls 1

compileConditionsMethod · 0.95

Tested by

no test coverage detected