Documentation
¶
Index ¶
- func Conn(cfg *gorm.Config) (db *gorm.DB)
- func DB(isTest bool, cfg *gorm.Config) (DB *gorm.DB, sql_ *sql.DB)
- func TestConn(cfg *gorm.Config) (db *gorm.DB)
- type DateTime
- type Model
- func (m *Model) Bind(ctx *gin.Context, data interface{}) (err error)
- func (m *Model) Create(data interface{}) (err error)
- func (m *Model) Delete(data interface{}, args ...interface{}) (err error)
- func (this *Model) GetNameOf(type_ interface{}, prefix string) string
- func (m *Model) Read(data interface{}, args ...interface{}) (err error)
- func (m *Model) SetConnection(conn *gorm.DB) *Model
- func (m *Model) SetILike(ilike ...string) *Model
- func (m *Model) SetPreload(pre ...string) *Model
- func (m *Model) Update(data interface{}, args ...interface{}) (err error)
- type ModelDT
- func (m *ModelDT) Bind(ctx *gin.Context, data interface{}) (err error)
- func (m *ModelDT) Create(data interface{}) (err error)
- func (m *ModelDT) Delete(data interface{}, args ...interface{}) (err error)
- func (this *ModelDT) GetNameOf(type_ interface{}, prefix string) string
- func (m *ModelDT) Read(data interface{}, args ...interface{}) (err error)
- func (m *ModelDT) SetConnection(conn *gorm.DB) *ModelDT
- func (m *ModelDT) SetILike(ilike ...string) *ModelDT
- func (m *ModelDT) SetPreload(pre ...string) *ModelDT
- func (m *ModelDT) Update(data interface{}, args ...interface{}) (err error)
- type PGSql
- type Pagination
- type PaginationDT
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DateTime ¶ added in v1.2.3
type DateTime int64
type Model ¶
type Model struct {
ID uint `gorm:"primarykey;index" json:"id" form:"id"`
CreatedAt int64 `gorm:"index" json:"created_at" form:"created_at"`
UpdatedAt int64 `gorm:"index" json:"updated_at" form:"updated_at"`
//Pagination and Filter
Pagination Pagination `json:"-" form:"-" gorm:"-"`
//Practice
IsTest bool `json:"-" form:"tutorial" gorm:"-"`
//ILike cond
ILike []string `json:"-" gorm:"-"`
Preload []string `json:"-" gorm:"-"`
// contains filtered or unexported fields
}
func (*Model) Delete ¶
Delete func for delete data from table base on model in data params and delete by args
func (*Model) GetNameOf ¶ added in v1.1.2
GetNameOf is a func for get name of structor model and make if snake case
func (*Model) SetPreload ¶ added in v1.0.3
SetPreload func for add some preload relation to model
type ModelDT ¶ added in v1.2.7
type ModelDT struct {
ID uint `gorm:"primarykey;index" json:"id" form:"id"`
CreatedAt time.Time `gorm:"index" json:"created_at" form:"created_at"`
UpdatedAt time.Time `gorm:"index" json:"updated_at" form:"updated_at"`
//Pagination and Filter
Pagination PaginationDT `json:"-" form:"-" gorm:"-"`
//Practice
IsTest bool `json:"-" form:"tutorial" gorm:"-"`
//ILike cond
ILike []string `json:"-" gorm:"-"`
Preload []string `json:"-" gorm:"-"`
// contains filtered or unexported fields
}
func (*ModelDT) Create ¶ added in v1.2.7
Create func for create data to table base on model in data params
func (*ModelDT) Delete ¶ added in v1.2.7
Delete func for delete data from table base on model in data params and delete by args
func (*ModelDT) GetNameOf ¶ added in v1.2.7
GetNameOf is a func for get name of structor model and make if snake case
func (*ModelDT) SetConnection ¶ added in v1.2.7
func (*ModelDT) SetPreload ¶ added in v1.2.7
SetPreload func for add some preload relation to model
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"`
}
type PaginationDT ¶ added in v1.2.7
type PaginationDT struct {
//Search
Keyword string `json:"-" form:"keyword"`
StartDate string `json:"-" form:"start_date"`
EndDate string `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.