Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var MetadataLoader metadataLoader = metadataLoader{}
Functions ¶
Types ¶
type BaseModel ¶
type BaseModel struct { ID int `json:"id" gorm:"column:id;primarykey;"` // 开启了自增长,第一个为“1” CreatedAt sql.NullTime `json:"createdAt" gorm:"column:created_at;comment:创建时间"` UpdatedAt sql.NullTime `json:"updatedAt" gorm:"column:updated_at;comment:更新时间"` DeletedAt sql.NullTime `json:"deletedAt" gorm:"column:deleted_at;index;comment:更新时间"` }
自定义公共模型参数
type DatabaseConfig ¶
type DatabaseConfig struct { Enable bool `mapstructure:"enable" json:"enable" yaml:"enable"` // 是否开启 EnableAutoMigrate bool `mapstructure:"enable-auto-migrate" json:"enableAutoMigrate" yaml:"enable-auto-migrate"` // 是否开启自动生成数据库表 EnableAutoImportData bool `mapstructure:"enable-auto-import-data" json:"enableAutoImportData" yaml:"enable-auto-import-data"` // 是否开启自动导入数据 LogMode string `mapstructure:"log-mode" json:"logMode" yaml:"log-mode"` // 日志模式 DBConfig Connect `mapstructure:"-" json:"-" yaml:"-"` // 数据库配置 }
func (DatabaseConfig) Load ¶
func (dbc DatabaseConfig) Load()
Click to show internal directories.
Click to hide internal directories.