Documentation
¶
Index ¶
- func MongoDB() *mongo.Database
- type Crud
- type Mongo
- func (m *Mongo) Create() Crud
- func (m *Mongo) CreateMore() Crud
- func (m *Mongo) CursorScan(cur *mongo.Cursor, data interface{})
- func (m *Mongo) DB() *mongo.Database
- func (m *Mongo) Delete(id interface{}) Crud
- func (m *Mongo) Error() error
- func (m *Mongo) Get(params cmap.CMap) Crud
- func (m *Mongo) GetByDataSearch(params bmap.BMap) (cur *mongo.Cursor, err error)
- func (m *Mongo) GetByID(id interface{}) Crud
- func (m *Mongo) GetBySearch(params bmap.BMap) Crud
- func (m *Mongo) Init(param *Params)
- func (m *Mongo) Pager() result.Pager
- func (m *Mongo) Params(params ...Param) Crud
- func (m *Mongo) RowsAffected() int64
- func (m *Mongo) Update() Crud
- type Param
- type Params
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Crud ¶ added in v1.30.0
type Crud interface { // Init crud Init(param *Params) // DB db DB() *mongo.Database // Params new/replace param // return param Params(param ...Param) Crud // GetBySearch get url params // like form data GetBySearch(params bmap.BMap) Crud // search single table Get(params cmap.CMap) Crud // get data no search GetByID(id interface{}) Crud // by id // Delete delete by id/ids Delete(id interface{}) Crud // delete // Update crud and search id // json data Update() Crud // update Create() Crud // create, include res insert id CreateMore() Crud // create more, data must array type, single table Error() error // crud error RowsAffected() int64 // inflect rows Pager() result.Pager // search pager }
Crud mongo
type Mongo ¶
type Mongo struct {
// contains filtered or unexported fields
}
Mongo implement Crud
func (*Mongo) CreateMore ¶
func (*Mongo) CursorScan ¶
CursorScan scan data to mongo data
func (*Mongo) GetByDataSearch ¶
func (*Mongo) GetBySearch ¶
GetBySearch pager info
func (*Mongo) RowsAffected ¶
type Params ¶
type Params struct { // attributes InnerTable []string // inner join tables LeftTable []string // left join tables Table string // table name Model interface{} // table model, like User{} KeyModel interface{} // key like model Data interface{} // table model data, like var user User{}, it is 'user', it store real data // count SubSQL string // SubQuery SQL // where WhereSQL string // SubWhere SQL }
Params crud params
Click to show internal directories.
Click to hide internal directories.