sql

package
v0.11.9 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

type Builder struct{}

Builder sql query builder

var DefaultBuilder Builder

func (*Builder) Delete

func (b *Builder) Delete(tableName string, where map[string]interface{}) (string, []interface{}, error)

func (*Builder) Insert

func (b *Builder) Insert(tableName string, columns []string, data ...[]interface{}) (string, []interface{}, error)

func (*Builder) Query

func (b *Builder) Query(tableName string, params map[string]interface{}) (string, []interface{}, error)

func (*Builder) Update

func (b *Builder) Update(tableName string, data, where map[string]interface{}) (string, []interface{}, error)

func (*Builder) Where

func (b *Builder) Where(where map[string]interface{}) (string, []interface{})

type Executor

type Executor struct {
	Log *utils.CombinedLogger

	Debug bool
	// contains filtered or unexported fields
}

Executor Database Driver

func (*Executor) Close

func (exec *Executor) Close()

Close

func (*Executor) Connect

func (exec *Executor) Connect(execName, dns string) (bool, error)

Connect db

@params execName, including mysql, sqlite3 @params dns, format:user:password@tpc(host:port)/databaseName?options

func (*Executor) Execute

func (exec *Executor) Execute(sql string, args ...interface{}) (int64, int64)

Execute sql, including insert, delete and update @return (int64 number of row affected,int64 the latest record id)

func (*Executor) GetDB

func (exec *Executor) GetDB() *sql.DB

GetDB

func (*Executor) IsCacheEngineOK

func (exec *Executor) IsCacheEngineOK() bool

IsCacheEngineOK

func (*Executor) Query

func (exec *Executor) Query(sql string, args ...interface{}) *sql.Rows

Query @params sql @params arg

func (*Executor) QueryCache

func (exec *Executor) QueryCache(cacheOpt map[string]interface{}, sql string, args ...interface{}) ([]map[string]interface{}, error)

QueryCache @params cacheOpt @params sql @params arg

func (*Executor) SetCacheEngine

func (exec *Executor) SetCacheEngine(cache cache.Cache)

SetCacheEngine

Jump to

Keyboard shortcuts

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