Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DatabaseConf ¶
type DatabaseConf struct { Host string `json:",env=DATABASE_HOST"` Port int `json:",env=DATABASE_PORT"` Username string `json:",default=root,env=DATABASE_USERNAME"` Password string `json:",optional,env=DATABASE_PASSWORD"` DBName string `json:",default=simple_admin,env=DATABASE_DBNAME"` SSLMode string `json:",optional,env=DATABASE_SSL_MODE"` Type string `json:",default=mysql,options=[mysql,postgres,sqlite3],env=DATABASE_TYPE"` MaxOpenConn int `json:",optional,default=100,env=DATABASE_MAX_OPEN_CONN"` CacheTime int `json:",optional,default=10,env=DATABASE_CACHE_TIME"` DBPath string `json:",optional,env=DATABASE_DBPATH"` MysqlConfig string `json:",optional,env=DATABASE_MYSQL_CONFIG"` PGConfig string `json:",optional,env=DATABASE_PG_CONFIG"` SqliteConfig string `json:",optional,env=DATABASE_SQLITE_CONFIG"` }
DatabaseConf stores database configurations.
func (DatabaseConf) GetDSN ¶
func (c DatabaseConf) GetDSN() string
GetDSN returns DSN according to the database type.
func (DatabaseConf) NewNoCacheDriver ¶
func (c DatabaseConf) NewNoCacheDriver() *entsql.Driver
NewNoCacheDriver returns an Ent driver without cache.
func (DatabaseConf) PostgresDSN ¶
func (c DatabaseConf) PostgresDSN() string
PostgresDSN returns Postgres DSN.
func (DatabaseConf) SqliteDSN ¶
func (c DatabaseConf) SqliteDSN() string
SqliteDSN returns Sqlite DSN.
Click to show internal directories.
Click to hide internal directories.