Documentation
¶
Index ¶
- type BaseModel
- type Gorm
- func (g *Gorm) Create(model interface{}) error
- func (g *Gorm) CreateTable(model interface{}) error
- func (g *Gorm) CreateTableList(models ...interface{}) error
- func (g *Gorm) Delete(model interface{}, id uint64) error
- func (g *Gorm) DeleteByIdLIst(model interface{}, ids ...uint64) error
- func (g *Gorm) Exists(model interface{}, key string, value interface{}) bool
- func (g *Gorm) Find(model interface{}, id uint64) error
- func (g *Gorm) FindByIdList(model interface{}, ids ...uint64) error
- func (g *Gorm) FindByMap(model interface{}, condition map[string]interface{}) error
- func (g *Gorm) InitMysql(config MysqlConfig)
- func (g *Gorm) Page(page, size int, model interface{})
- func (g *Gorm) Update(model interface{}) error
- type GormConfig
- type JsonList
- type MysqlConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseModel ¶
type BaseModel struct {
ID uint64 `gorm:"primarykey"`
CreatedAt time.Time `gorm:"column:add_time"` // 添加时间
UpdatedAt time.Time `gorm:"column:update_time"` // 修改时间
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at"` // 删除时间
}
BaseModel 基础模型
type Gorm ¶
Gorm 核心对象
func (*Gorm) CreateTableList ¶
CreateTableList 创建多个表格
func (*Gorm) DeleteByIdLIst ¶
DeleteByIdLIst 根据id列表删除数据
func (*Gorm) FindByIdList ¶
FindByIdList 根据id列表查询
func (*Gorm) InitMysql ¶
func (g *Gorm) InitMysql(config MysqlConfig)
InitMysql 初始化Mysql数据库连接 @param config MySQL配置对象
type GormConfig ¶
GormConfig 配置对象
type MysqlConfig ¶
type MysqlConfig struct {
Host string `mapstructure:"host" json:"host"` // 主机地址
Port int `mapstructure:"port" json:"port"` // 端口号
Database string `mapstructure:"db" json:"database"` // 数据库名称
User string `mapstructure:"user" json:"username"` // 用户名
Password string `mapstructure:"password" json:"password"` // 密码
}
MysqlConfig MySQL配置信息
Click to show internal directories.
Click to hide internal directories.