Documentation
¶
Index ¶
- Constants
- func BuildDataSource(c ModelConf) string
- func MustSqlConn(c ModelConf) sqlx.SqlConn
- func WithCacheConf(cacheConf cache.CacheConf) opts.Opt[ModelOpts]
- func WithCacheOpts(cacheOpts ...cache.Option) opts.Opt[ModelOpts]
- func WithCachedConn(cachedConn sqlc.CachedConn) opts.Opt[ModelOpts]
- type ModelConf
- type ModelOpts
- type MysqlConf
- type PostgresConf
Constants ¶
View Source
const ( DatabaseTypeMysql = "mysql" DatabaseTypePostgres = "postgres" )
Variables ¶
This section is empty.
Functions ¶
func BuildDataSource ¶
func MustSqlConn ¶
func WithCachedConn ¶
func WithCachedConn(cachedConn sqlc.CachedConn) opts.Opt[ModelOpts]
Types ¶
type ModelConf ¶
type ModelConf struct {
DatabaseType string `json:"databaseType,default=mysql,options=mysql|sqlite|postgres"`
DatabaseUrl string `json:"databaseUrl,optional"`
Mysql MysqlConf `json:"mysql,optional"`
Postgres PostgresConf `json:"postgres,optional"`
}
type ModelOpts ¶
type ModelOpts struct {
CachedConn *sqlc.CachedConn
CacheConf cache.CacheConf
CacheOpts []cache.Option
}
func (ModelOpts) DefaultOptions ¶
type PostgresConf ¶
type PostgresConf struct {
Host string `json:"host,default=localhost"`
Port int `json:"port,default=5432"`
Username string `json:"username,default=root"`
Password string `json:"password,default=123456"`
Database string `json:"database,default=jzero"`
SslMode string `json:"sslMode,default=disable"`
}
Click to show internal directories.
Click to hide internal directories.