batis

package module
v0.0.0-...-1dca073 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2021 License: Apache-2.0 Imports: 16 Imported by: 0

README

go-batis

Documentation

Index

Constants

View Source
const MaxIdleConns = 50
View Source
const MaxOpenConns = 100

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache interface {
	Set(key string, value interface{}) error
	Get(key string) (interface{}, error)
	Del(key string) error
	Ttl(key string, value interface{}, duration time.Duration) error
}

type Clause

type Clause struct {
	// contains filtered or unexported fields
}

func (*Clause) CacheKey

func (clause *Clause) CacheKey() (string, error)

func (*Clause) SqlType

func (clause *Clause) SqlType() SqlType

func (*Clause) Statement

func (clause *Clause) Statement() string

type DataSource

type DataSource struct {
	*sql.DB
	// contains filtered or unexported fields
}

func NewDs

func NewDs(cfg *DbConfig, cache Cache) (*DataSource, error)

func NewDsDefaultCache

func NewDsDefaultCache(cfg *DbConfig) (ds *DataSource, err error)

func (*DataSource) Del

func (ds *DataSource) Del(key string) error

func (*DataSource) Exec

func (ds *DataSource) Exec(mapper SqlMapper, args interface{}) error

update, delete

func (*DataSource) ExecContext

func (ds *DataSource) ExecContext(ctx context.Context, mapper SqlMapper, arg interface{}) error

func (*DataSource) ExecSql

func (ds *DataSource) ExecSql(query string, args ...interface{}) (sql.Result, error)

func (*DataSource) Get

func (ds *DataSource) Get(key string) (interface{}, error)

func (*DataSource) MapperDir

func (ds *DataSource) MapperDir() string

func (*DataSource) Query

func (ds *DataSource) Query(dest interface{}, mapper SqlMapper, arg interface{}) error

Select using this DB.

func (DataSource) QueryContext

func (ds DataSource) QueryContext(ctx context.Context, dest interface{}, mapper SqlMapper, arg interface{}) error

func (*DataSource) Set

func (ds *DataSource) Set(key string, value interface{}) error

func (*DataSource) Ttl

func (ds *DataSource) Ttl(key string, value interface{}, duration time.Duration) error

func (*DataSource) WithSqlHook

func (ds *DataSource) WithSqlHook(h ...SqlHookFunc)

type DbConfig

type DbConfig struct {
	DriverName            string `mapstructure:"driverName"`
	Url                   string `mapstructure:"url"`
	MaxOpenConns          int    `mapstructure:"maxOpenConns"`
	MaxIdleConns          int    `mapstructure:"maxIdleConns"`
	MaxTransactionRetries int    `mapstructure:"maxTransactionRetries"`
	// Mapper dir name
	MapperDir string `mapstructure:"mapperDir"`
}

type Finder

type Finder SqlMapper

func (Finder) Exec

func (f Finder) Exec(arg interface{}) interface{}

type Searcher

type Searcher SqlMapper

func (Searcher) Exec

func (s Searcher) Exec(arg interface{}) []interface{}

type SqlHookFunc

type SqlHookFunc func(ctx context.Context, clause *Clause) (string, error)

type SqlMapper

type SqlMapper string

type SqlType

type SqlType string

type StatementType

type StatementType string

type Updater

type Updater SqlMapper

func (Updater) Exec

func (u Updater) Exec(arg interface{}) (sql.Result, error)

Directories

Path Synopsis
Package reflectx implements extensions to the standard reflect lib suitable for implementing marshalling and unmarshalling packages.
Package reflectx implements extensions to the standard reflect lib suitable for implementing marshalling and unmarshalling packages.

Jump to

Keyboard shortcuts

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