mysql

package module
v0.0.0-...-b4dad9e Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cli

type Cli struct {
	*gorm.DB
}

func Connect

func Connect(dsn string, options ...Option) (*Cli, error)

func (*Cli) Begin

func (c *Cli) Begin() *Tx

func (*Cli) ExecProcedure

func (c *Cli) ExecProcedure(sql string, args map[string]interface{}) *gorm.DB

func (*Cli) ExecRawSql

func (c *Cli) ExecRawSql(sql string, args map[string]interface{}) *gorm.DB

type LogLevel

type LogLevel int

LogLevel log level

const (
	// Silent silent log level
	Silent LogLevel = iota + 1
	// Error error log level
	Error
	// Warn warn log level
	Warn
	// Info info log level
	Info
)

type Option

type Option func(*option)

func WithLogLevel

func WithLogLevel(lv LogLevel) Option

func WithMaxIdleConns

func WithMaxIdleConns(num int) Option

The default max idle connections is currently 2.

func WithMaxOpenConns

func WithMaxOpenConns(num int) Option

func WithProcedureParamRegexp

func WithProcedureParamRegexp(exp string) Option

func WithRawParamRegexp

func WithRawParamRegexp(exp string) Option

type Tx

type Tx struct {
	*gorm.DB
}

func (*Tx) ExecProcedure

func (c *Tx) ExecProcedure(sql string, args map[string]interface{}) *gorm.DB

func (*Tx) ExecRawSql

func (c *Tx) ExecRawSql(sql string, args map[string]interface{}) *gorm.DB

Jump to

Keyboard shortcuts

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