Documentation ¶
Overview ¶
Package sgorm is a library encapsulated on gorm.io/gorm
Index ¶
Constants ¶
View Source
const ( // DBDriverMysql mysql driver DBDriverMysql = "mysql" // DBDriverPostgresql postgresql driver DBDriverPostgresql = "postgresql" // DBDriverTidb tidb driver DBDriverTidb = "tidb" // DBDriverSqlite sqlite driver DBDriverSqlite = "sqlite" )
Variables ¶
View Source
var ErrRecordNotFound = gorm.ErrRecordNotFound
Functions ¶
Types ¶
type Model ¶
type Model struct { ID uint64 `gorm:"column:id;AUTO_INCREMENT;primary_key" json:"id"` CreatedAt time.Time `gorm:"column:created_at" json:"createdAt"` UpdatedAt time.Time `gorm:"column:updated_at" json:"updatedAt"` DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;index" json:"-"` }
Model embedded structs, add `gorm: "embedded"` when defining table structs
type Model2 ¶
type Model2 struct { ID uint64 `gorm:"column:id;AUTO_INCREMENT;primary_key" json:"id"` CreatedAt time.Time `gorm:"column:created_at" json:"created_at"` UpdatedAt time.Time `gorm:"column:updated_at" json:"updated_at"` DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;index" json:"-"` }
Model2 embedded structs, json tag named is snake case
Directories ¶
Path | Synopsis |
---|---|
Package dbclose provides a function to close gorm db.
|
Package dbclose provides a function to close gorm db. |
Package glog provides a gorm logger implementation based on zap.
|
Package glog provides a gorm logger implementation based on zap. |
Package mysql provides a gorm driver for mysql.
|
Package mysql provides a gorm driver for mysql. |
Package postgresql provides a gorm driver for postgresql.
|
Package postgresql provides a gorm driver for postgresql. |
Package query 是一个自定义条件查询库,支持复杂的分页查询。
|
Package query 是一个自定义条件查询库,支持复杂的分页查询。 |
Package sqlite provides a gorm driver for sqlite.
|
Package sqlite provides a gorm driver for sqlite. |
Click to show internal directories.
Click to hide internal directories.