Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConnectMysql ¶
ConnectMysql build a connection to mysql
func ConnectSqlite3 ¶
func ConnectSqlite3(c *types.SQLite3Config) (*gorm.DB, error)
ConnectSqlite3 .
Types ¶
type Join ¶
type Join struct { Query string Args []interface{} }
Join . db.Joins("JOIN department on department.id = employee.department_id AND employee.name = ?", "Jenkins")
type Model ¶
type Model struct { ID string `gorm:"column:id;index;not null;type:varchar(128)"` CreateTime time.Time `gorm:"column:create_time"` UpdateTime time.Time `gorm:"column:update_time"` }
Model ... as custom gorm model with some callbacks BeforeCreate ... create 之前调用 BeforeUpdate ... update 之前调用
type Paginator ¶
type Paginator struct { Total uint `json:"total"` Records interface{} `json:"records"` Error error `json:"error,omitempty"` }
Paginator 分页返回
type PagingParam ¶
type PagingParam struct { DB *gorm.DB // DB Data Source Limit uint // Limit Offset uint // Offset Select string // Select OrderBy []string // Orders GroupBy string // Group Joins []Join // Joins Wheres []Where // Wheres ORs []Where // ORs Not interface{} // Not Preloads []string // Preload ShowSQL bool // Debug mode }
PagingParam 分页参数
Click to show internal directories.
Click to hide internal directories.