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"` // 是否开启自动导入数据 DBType string `mapstructure:"db-type" json:"dbType" yaml:"db-type"` // 数据库类型 Mysql connect.Mysql `mapstructure:"mysql" json:"mysql" yaml:"mysql"` // mysql数据库 Pgsql connect.Pgsql `mapstructure:"pgsql" json:"pgsql" yaml:"pgsql"` // postgresql数据库 }
func (DatabaseConfig) Load ¶
func (db DatabaseConfig) Load()
Click to show internal directories.
Click to hide internal directories.