Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
DB *gorm.DB
)
Functions ¶
Types ¶
type BaseModel ¶
type BaseModel struct { CreatedTimeStr string `json:"createdTime" gorm:"-"` CreatedTime *time.Time `json:"-" gorm:"column:created_time; type:datetime; not null; default:current_timestamp"` UpdatedTime *time.Time `json:"-" gorm:"column:updated_time; type:datetime"` DeletedTime *time.Time `json:"-" gorm:"column:deleted_time; type:datetime"` IsDeleted int64 `json:"-" gorm:"column:is_deleted; type:tinyint(1); not null; default:0"` }
type BmbUser ¶
type BmbUser struct { ID int64 `json:"-" gorm:"column:id; type:int(11); primary_key; auto_increment"` UserID string `` /* 126-byte string literal not displayed */ Username string `json:"username" gorm:"column:username; type:varchar(20); not null"` HeadPhoto string `json:"headPhoto" gorm:"column:head_photo; type:varchar(200); not null"` Sex int64 `json:"sex" gorm:"column:sex; type:tinyint(1); not null; default:1"` Pid int64 `json:"pid" gorm:"column:pid; type:tinyint(4); not null; default:1"` Cid int64 `json:"cid" gorm:"column:cid; type:tinyint(4); not null; default:1"` BaseModel }
func (*BmbUser) FindUserByUserID ¶
type Model ¶
Model facilitate database interactions, support mysql
func NewModel ¶
func NewModel() *Model
NewModel returns a new Model without opening database connection
func NewModelWithConfig ¶
func NewModelWithConfig(dialect string, host string, port int64, dbname string, user string, password string) (*Model, error)
NewModelWithConfig creates a new model, and opens database connection based on cfg settings
func (*Model) AutoMigrateAll ¶
func (m *Model) AutoMigrateAll()
AutoMigrateAll runs migrations for all the registered models
Click to show internal directories.
Click to hide internal directories.