Documentation ¶
Index ¶
- func ApplyOptions(opt *option, fns ...OptionFunc)
- func Init(dbName string, conf *Config) error
- func NewLogger(fields ...zap.Field) grrmLogger.Interface
- func Otlp(conf *Config) gorm.Plugin
- func RegisterPlugin(name string, fn PluginFunc)
- func RegistryDriver(name string, driver Driver)
- type BaseDb
- type ClickhouseDriver
- type Config
- type Driver
- type Logger
- func (l *Logger) Error(ctx context.Context, s string, i ...interface{})
- func (l *Logger) Info(ctx context.Context, s string, i ...interface{})
- func (l *Logger) LogMode(level grrmLogger.LogLevel) grrmLogger.Interface
- func (l *Logger) Trace(ctx context.Context, begin time.Time, ...)
- func (l *Logger) Warn(ctx context.Context, s string, i ...interface{})
- type MysqlDriver
- type OptionFunc
- type PluginFunc
- type PostgreSqlDriver
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyOptions ¶
func ApplyOptions(opt *option, fns ...OptionFunc)
func RegisterPlugin ¶ added in v0.2.0
func RegisterPlugin(name string, fn PluginFunc)
func RegistryDriver ¶
Types ¶
type ClickhouseDriver ¶
type ClickhouseDriver struct{}
type Config ¶
type Config struct { Driver string `json:"driver" yaml:"driver" validate:"required"` Host string `json:"host" yaml:"host" validate:"required"` Database string `json:"database" yaml:"database" validate:"required"` Port int `json:"port" yaml:"port" validate:"required"` Username string `json:"username" yaml:"username" validate:"required"` Password string `json:"password" yaml:"password" validate:"required"` MaxIdleConnes int `json:"max_idle_connes" yaml:"max_idle_connes" validate:"required"` MaxOpenConnes int `json:"max_open_connes" yaml:"max_open_connes" validate:"required"` MaxLifetime int `json:"max_lifetime" yaml:"max_lifetime" validate:"required"` WriteTimeout time.Duration `json:"write_timeout" yaml:"write_timeout" validate:"required"` ReadTimeout time.Duration `json:"read_timeout" yaml:"read_timeout" validate:"required"` Plugins []string `json:"plugins" yaml:"plugins"` }
type Logger ¶
func (*Logger) LogMode ¶
func (l *Logger) LogMode(level grrmLogger.LogLevel) grrmLogger.Interface
type MysqlDriver ¶
type MysqlDriver struct{}
type OptionFunc ¶ added in v0.2.0
type OptionFunc func(*option)
func WithDebugLog ¶
func WithDebugLog(isDebug bool) OptionFunc
func WithMaxIdleConn ¶
func WithMaxIdleConn(maxIdleConn int) OptionFunc
func WithMaxLifetime ¶
func WithMaxLifetime(maxLifetime time.Duration) OptionFunc
func WithMaxOpenConn ¶
func WithMaxOpenConn(maxOpenConn int) OptionFunc
func WithPlugins ¶ added in v0.2.0
func WithPlugins(plugins ...string) OptionFunc
type PluginFunc ¶ added in v0.2.0
func PluginFuncByName ¶ added in v0.2.0
func PluginFuncByName(name string) (PluginFunc, bool)
type PostgreSqlDriver ¶
type PostgreSqlDriver struct{}
Click to show internal directories.
Click to hide internal directories.