config

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 31, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

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
	Port         int
	Username     string `json:",default=root"`
	Password     string `json:",optional"`
	DBName       string `json:",default=simple_admin"`
	SSLMode      string `json:",optional"`
	Type         string `json:",default=mysql,options=[mysql,postgres,sqlite3]"`
	MaxOpenConns int    `json:",optional,default=100"`
	Debug        bool   `json:",optional,default=false"`
	CacheTime    int    `json:",optional,default=10"`
	DBPath       string `json:",optional"`
}

DatabaseConf stores database configurations.

func (DatabaseConf) GetDSN

func (c DatabaseConf) GetDSN() string

GetDSN returns DSN according to the database type.

func (DatabaseConf) MysqlDSN

func (c DatabaseConf) MysqlDSN() string

MysqlDSN returns mysql DSN.

func (DatabaseConf) NewCacheDriver

func (c DatabaseConf) NewCacheDriver(redisConf redis2.RedisConf) *entcache.Driver

NewCacheDriver returns an Ent driver with cache.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL