Documentation ¶
Index ¶
- type Model
- func (m *Model) Bind(ctx *gin.Context, data interface{}) (err error)
- func (this *Model) Create(mdl interface{}) (err error)
- func (this *Model) Delete(data interface{}, filter bson.M, opts ...*options.DeleteOptions) (err error)
- func (this *Model) Get(data interface{}, filter bson.M, opts ...*options.FindOptions) (err error)
- func (this *Model) Update(data interface{}, filter bson.M, opts ...*options.UpdateOptions) (err error)
- type Mongo
- type Pagination
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Model ¶
type Model struct { ID primitive.ObjectID `bson:"_id" json:"id" form:"id"` CreatedAt int64 `bson:"created_at" json:"created_at" form:"created_at"` UpdatedAt int64 `bson:"updated_at" json:"updated_at" form:"updated_at"` //Pagination and Filter Pagination Pagination `json:"-" form:"-" bson:"-"` //Practice IsTest bool `json:"-" form:"tutorial" bson:"-"` }
Model of Collection
type Pagination ¶
type Pagination struct { //Search Keyword string `json:"-" form:"keyword"` StartDate int64 `json:"-" form:"start_date"` EndDate int64 `json:"-" form:"end_date"` Sort string `json:"-" form:"sort"` SortBy string `json:"-" form:"sort_by"` //Pagination ShowAll bool `json:"-" form:"show_all"` Page int64 `json:"current_page" form:"page"` PageSize int64 `json:"page_size" form:"page_size"` TotalPage int64 `json:"page_total"` TotalData int64 `json:"data_total"` HasNext bool `json:"has_next"` HasPrev bool `json:"has_previous"` }
Click to show internal directories.
Click to hide internal directories.