Documentation ¶
Index ¶
- Variables
- func CreateDatabaseIfNotExists(db *gorm.DB, database string) error
- func GetDB() (*gorm.DB, error)
- func MustSetUp(config *Config, logConfig *LogConfig)
- func NewLogger(logConfig *LogConfig) logger.Interface
- func SetUp(config *Config, logConfig *LogConfig) (err error)
- func StringToLevel(str string) (level logger.LogLevel, err error)
- type Config
- type DsnConfig
- type LogConfig
Constants ¶
This section is empty.
Variables ¶
View Source
var (
NotSetupError = errorKit.Newf("haven’t been set up correctly")
)
Functions ¶
func CreateDatabaseIfNotExists ¶
CreateDatabaseIfNotExists 自动创建数据库
在 Go 项目中优雅的使用 gorm v2
https://segmentfault.com/a/1190000039097157
Types ¶
type Config ¶
type Config struct { DsnConfig Pool gormKit.PoolConfig `json:"pool" yaml:"pool"` }
Click to show internal directories.
Click to hide internal directories.