Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DbPointer = (*mgo.Database)(nil)
View Source
var OperatorMapping = map[string]CriterionProvider{ "=": func(value interface{}) (interface{}, error) { return map[string]interface{}{ "$eq": value, }, nil }, "!=": func(value interface{}) (interface{}, error) { return map[string]interface{}{ "$ne": value, }, nil }, "<": func(value interface{}) (interface{}, error) { return map[string]interface{}{ "$lt": value, }, nil }, "<=": func(value interface{}) (interface{}, error) { return map[string]interface{}{ "$lte": value, }, nil }, ">": func(value interface{}) (interface{}, error) { return map[string]interface{}{ "$gt": value, }, nil }, ">=": func(value interface{}) (interface{}, error) { return map[string]interface{}{ "$gte": value, }, nil }, "IN": func(value interface{}) (interface{}, error) { if toolbox.IsString(value) { value = strings.Split(toolbox.AsString(value), ",") } if toolbox.IsSlice(value) { fmt.Errorf("expected slice but had: %T", value) } return map[string]interface{}{ "$in": toolbox.AsSlice(value), }, nil }, "NOT IN": func(value interface{}) (interface{}, error) { if toolbox.IsString(value) { value = strings.Split(toolbox.AsString(value), ",") } if toolbox.IsSlice(value) { fmt.Errorf("expected slice but had: %T", value) } return map[string]interface{}{ "$nin": value, }, nil }, }
View Source
var SessionPointer = (*mgo.Session)(nil)
Functions ¶
func AsMongoCriteria ¶
func AsMongoCriteria(sqlCriteria *dsc.SQLCriteria, parameters []interface{}) (map[string]interface{}, error)
func MapCriterion ¶
Types ¶
type CriterionProvider ¶
type CriterionProvider func(value interface{}) (interface{}, error)
CriterionProvider represents criteria provider
Click to show internal directories.
Click to hide internal directories.