Documentation ¶ Index ¶ func GetORM() *gorm.DB func GetORMByName(name string) *gorm.DB func InitDB(list []*DBConfig) (err error) func InitDefaultDB(db *DBConfig) (err error) type DBConfig Constants ¶ This section is empty. Variables ¶ This section is empty. Functions ¶ func GetORM ¶ func GetORM() *gorm.DB GetORM return default *gorm.DB func GetORMByName ¶ func GetORMByName(name string) *gorm.DB GetORMByName get orm by name func InitDB ¶ func InitDB(list []*DBConfig) (err error) InitDB init multiple db func InitDefaultDB ¶ func InitDefaultDB(db *DBConfig) (err error) InitDefaultDB init single db config Types ¶ type DBConfig ¶ type DBConfig struct { Name string //库名 User string //登录名 Password string //密码 Host string //主机 Port int //port Debug bool //是否debug DisablePrepared bool //是否disable prepared } DBConfig mysql配置文件 Source Files ¶ View all Source files gorm.go Click to show internal directories. Click to hide internal directories.