Documentation ¶
Index ¶
- Variables
- func MapToStruct(m map[string]interface{}, out interface{}) error
- func StructToAddrMap(in interface{}, tag string) (map[string]reflect.Value, error)
- func StructToMap(in interface{}, tag string, withValue bool) (m map[string]interface{}, err error)
- type DB
- func (db *DB) Delete(name string, ID string, result interface{}) error
- func (db *DB) Get(name string, filter interface{}, result interface{}, pageNum int, pageSize int) error
- func (db *DB) Insert(name string, values ...interface{}) error
- func (db *DB) Update(name string, ID string, update interface{}, result interface{}) error
- type StructField
Constants ¶
This section is empty.
Variables ¶
var FieldKey = "bson"
FieldKey is the struct tag for field names
var PageSize = 100000
PageSize if the default page size applied if none supplied for search
Functions ¶
func MapToStruct ¶
MapToStruct converts map to given struct
func StructToAddrMap ¶
StructToAddrMap returns a map of fielname(or tag) to field variable reference if not struct or pointer to struct it fails
func StructToMap ¶
StructToMap converts a struct to map of string to interface Its uses the tag 'map' or given `tag` to check the name to be used if the value is zero value and withValue is true no key is added if there are embeded structs they are also traversed recursively in case of embeded structs having same field name and struct tag the last field in order will be considered
Types ¶
type DB ¶
DB Database implementation for mongo
func (*DB) Get ¶
func (db *DB) Get(name string, filter interface{}, result interface{}, pageNum int, pageSize int) error
Get fiters the table given filter and pagination logic Current implementation does not support search with other types of predicates The request is paginated with pagenum and page size parameters
type StructField ¶
type StructField struct { Type reflect.StructField Value reflect.Value }
StructField represents a struct field with field type and value