Documentation
¶
Index ¶
- Variables
- func NewDB(URL string, dopts *Options) (*bun.DB, error)
- func SetPool(sqldb *sql.DB, opts *Options)
- func WithConnMaxIdleTimeMS(ConnMaxIdleTimeMS int) optparams.Option[Options]
- func WithConnMaxLifetimeMS(ConnMaxLifetimeMS int) optparams.Option[Options]
- func WithDiscardUnknownColumns() optparams.Option[Options]
- func WithMaxIdleConns(MaxIdleConns int) optparams.Option[Options]
- func WithMaxOpenConns(MaxOpenConns int) optparams.Option[Options]
- func WithParallelCallback() optparams.Option[Options]
- func WithQueryTimeoutMS(QueryTimeout int) optparams.Option[Options]
- type Callback
- type Options
- type Proxy
Constants ¶
This section is empty.
Variables ¶
View Source
var Default = New()
Default 默认的数据库代理对象
View Source
var DefaultOpts = Options{}
View Source
var ErrProxyAllreadySettedUniversalClient = errors.New("代理不能重复设置客户端对象")
ErrProxyAllreadySettedUniversalClient 代理已经设置过redis客户端对象
View Source
var ErrProxyNotYetSettedUniversalClient = errors.New("代理还未设置客户端对象")
ErrProxyNotYetSettedUniversalClient 代理还未设置客户端对象
View Source
var ErrUnSupportSchema = errors.New("未支持的数据库管理服务类型")
ErrUnSupportSchema 未支持的数据库管理服务类型
View Source
var ErrUnknownClientType = errors.New("未知的redis客户端类型")
ErrUnknownClientType 未知的redis客户端类型
View Source
var Logger *log.Log
Functions ¶
func WithConnMaxIdleTimeMS ¶
WithConnMaxIdleTimeMS 设置连接池的最大空闲连接超时时间,单位ms
func WithConnMaxLifetimeMS ¶
WithConnMaxLifetimeMS 设置连接池的最大连接超时时间,单位ms
func WithDiscardUnknownColumns ¶
WithDiscardUnknownColumns 设置当有未知列时不报错
func WithMaxIdleConns ¶
WithMaxIdleConns 设置连接池的最大空闲连接数
func WithMaxOpenConns ¶
WithMaxOpenConns 设置连接池的最大连接数
func WithParallelCallback ¶
WithParallelCallback 设置初始化后回调并行执行而非串行执行
Types ¶
type Options ¶
type Options struct { Parallelcallback bool // 只在Init方法中生效 QueryTimeout time.Duration // 只在Init方法中生效 MaxOpenConns int ConnMaxLifetime time.Duration MaxIdleConns int ConnMaxIdleTime time.Duration DiscardUnknownColumns bool }
Option 设置key行为的选项 @attribute MaxTTL time.Duration 为0则不设置过期 @attribute AutoRefresh string 需要为crontab格式的字符串,否则不会自动定时刷新
Click to show internal directories.
Click to hide internal directories.