Documentation ¶
Index ¶
- type All
- type Model
- type Mongodb
- func (m *Mongodb) All(in All, filter bson.M) error
- func (m *Mongodb) Create(model interface{}) (*validate.Errors, error)
- func (m *Mongodb) Details() *pop.ConnectionDetails
- func (m *Mongodb) Get(in interface{}, filter bson.M) error
- func (m *Mongodb) GetCollection(mdl *Model) *mongo.Collection
- func (m *Mongodb) Name() string
- func (m *Mongodb) Ping() error
- func (m *Mongodb) URL() string
- func (m *Mongodb) Update(model interface{}) (*validate.Errors, error)
- type ValidateAble
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type All ¶
type All interface { // return empty instance of slice type // PTR only!!!!! T() interface{} // add to back Add(interface{}) error }
All represent slice
type Model ¶
func (*Model) GetObjectID ¶
GetObjectID find bson ObjectID in structure and return bson.M for searching model linked to this ID
func (*Model) UpdateObjectID ¶
func (m *Model) UpdateObjectID()
UpdateObjectID generate new BSON ObjectID for first found in struct
type Mongodb ¶
type Mongodb struct { ConnectionDetails *pop.ConnectionDetails // contains filtered or unexported fields }
Mongodb is helper for access to MongoDB. Current approach used here not support concurrent access => used Mutex for protect this. Goal of this adapter help to develop simple low/mid loaded systems.
func (*Mongodb) All ¶
All pollute @in parameter of All interface with data witch was founded. @filter - simple map[string]interface{}, where string is in model var. name (key) and interface value of this key
func (*Mongodb) Details ¶
func (m *Mongodb) Details() *pop.ConnectionDetails
func (*Mongodb) Get ¶
Get make search one document corresponding to filter rules. @filter - simple map[string]interface{}, where string is in model var. name (key) and interface value of this key
func (*Mongodb) GetCollection ¶
func (m *Mongodb) GetCollection(mdl *Model) *mongo.Collection
GetCollection create collection object suitable for current instance of model.