modelx

package
v0.18.4 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildDataSource added in v0.15.0

func BuildDataSource(c ModelxConfig) string

func MustSqlxConn added in v0.15.0

func MustSqlxConn(c ModelxConfig) sqlx.SqlConn

func WithCacheConf

func WithCacheConf(cacheConf cache.CacheConf) opts.Opt[ModelOpts]

func WithCacheOpts

func WithCacheOpts(cacheOpts ...cache.Option) opts.Opt[ModelOpts]

func WithCachedConn added in v0.9.1

func WithCachedConn(cachedConn sqlc.CachedConn) opts.Opt[ModelOpts]

Types

type DatabaseConf added in v0.15.0

type DatabaseConf struct {
	Host     string `json:"host,default=localhost"`
	Port     int    `json:"port,default=3306"`
	Username string `json:"username,default=root"`
	Password string `json:"password,default=123456"`
	DbName   string `json:"dbName,default=test"`
}

type ModelOpts

type ModelOpts struct {
	CachedConn *sqlc.CachedConn
	CacheConf  cache.CacheConf
	CacheOpts  []cache.Option
}

func (ModelOpts) DefaultOptions

func (opts ModelOpts) DefaultOptions() ModelOpts

type ModelxConfig added in v0.15.0

type ModelxConfig struct {
	DatabaseType string `json:"databaseType,default=mysql"`

	Mysql  MysqlConf  `json:"mysql,"`
	Sqlite SqliteConf `json:"sqlite,"`
}

type MysqlConf added in v0.15.0

type MysqlConf struct {
	DatabaseConf
}

type SqliteConf added in v0.15.0

type SqliteConf struct {
	Path string `json:"path,default=data.db"`
}

Jump to

Keyboard shortcuts

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