mysql

package
v1.3.168 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: MIT Imports: 13 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AboveOpr

func AboveOpr(name string, val model.RawVal, resultStackPtr *ResultStack) string

AboveOpr Above Opr

func BelowOpr

func BelowOpr(name string, val model.RawVal, resultStackPtr *ResultStack) string

BelowOpr Below Opr

func EqualOpr

func EqualOpr(name string, val model.RawVal, resultStackPtr *ResultStack) string

EqualOpr Equal Opr

func InOpr

func InOpr(name string, val model.RawVal, resultStackPtr *ResultStack) string

InOpr In Opr

func IsKeyWord

func IsKeyWord(str string) bool

IsKeyWord check if a keyword

func LikeOpr

func LikeOpr(name string, val model.RawVal, resultStackPtr *ResultStack) string

LikeOpr Like Opr

func NotEqualOpr

func NotEqualOpr(name string, val model.RawVal, resultStackPtr *ResultStack) string

NotEqualOpr NotEqual Opr

func NotInOpr

func NotInOpr(name string, val model.RawVal, resultStackPtr *ResultStack) string

NotInOpr NotIn Opr

func SortOpr added in v1.2.0

func SortOpr(name string, ascSort bool) string

SortOpr sort opr

Types

type Builder

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

Builder Builder

func New

func New(provider provider.Provider, codec codec.Codec) *Builder

New create builder

func (*Builder) BuildCount

func (s *Builder) BuildCount(vModel model.Model, filter model.Filter) (ret *ResultStack, err *cd.Result)

BuildCount build count

func (*Builder) BuildCreateRelationTable added in v1.3.28

func (s *Builder) BuildCreateRelationTable(vModel model.Model, vField model.Field, rModel model.Model) (ret *ResultStack, err *cd.Result)

BuildCreateRelationTable Build CreateRelation Schema

func (*Builder) BuildCreateTable added in v1.3.28

func (s *Builder) BuildCreateTable(vModel model.Model) (ret *ResultStack, err *cd.Result)

func (*Builder) BuildDelete

func (s *Builder) BuildDelete(vModel model.Model) (ret *ResultStack, err *cd.Result)

BuildDelete BuildDelete

func (*Builder) BuildDeleteRelation

func (s *Builder) BuildDeleteRelation(vModel model.Model, vField model.Field, rModel model.Model) (delHost, delRelation *ResultStack, err *cd.Result)

BuildDeleteRelation BuildDeleteRelation

func (*Builder) BuildDropRelationTable added in v1.3.28

func (s *Builder) BuildDropRelationTable(vModel model.Model, vField model.Field, rModel model.Model) (ret *ResultStack, err *cd.Result)

BuildDropRelationTable Build DropRelation Schema

func (*Builder) BuildDropTable added in v1.3.28

func (s *Builder) BuildDropTable(vModel model.Model) (ret *ResultStack, err *cd.Result)

BuildDropTable BuildDropSchema

func (*Builder) BuildInsert

func (s *Builder) BuildInsert(vModel model.Model) (ret *ResultStack, err *cd.Result)

BuildInsert Build Insert

func (*Builder) BuildInsertRelation

func (s *Builder) BuildInsertRelation(vModel model.Model, vField model.Field, rModel model.Model) (ret *ResultStack, err *cd.Result)

BuildInsertRelation Build Insert Relation

func (*Builder) BuildQuery

func (s *Builder) BuildQuery(vModel model.Model, filter model.Filter) (ret *ResultStack, err *cd.Result)

BuildQuery build query sql

func (*Builder) BuildQueryPlaceHolder added in v1.3.147

func (s *Builder) BuildQueryPlaceHolder(vModel model.Model) (ret []any, err *cd.Result)

func (*Builder) BuildQueryRelation

func (s *Builder) BuildQueryRelation(vModel model.Model, vField model.Field, rModel model.Model) (ret *ResultStack, err *cd.Result)

BuildQueryRelation build query relation sql

func (*Builder) BuildQueryRelationPlaceHolder added in v1.3.147

func (s *Builder) BuildQueryRelationPlaceHolder(vModel model.Model, vField model.Field, rModel model.Model) (ret any, err *cd.Result)

func (*Builder) BuildUpdate

func (s *Builder) BuildUpdate(vModel model.Model) (ret *ResultStack, err *cd.Result)

BuildUpdate Build Update

func (*Builder) GetFieldPlaceHolder added in v1.3.147

func (s *Builder) GetFieldPlaceHolder(vField model.Field) (ret any, err *cd.Result)

type Config

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

func NewConfig

func NewConfig(dbServer, dbName, username, password, charSet string) *Config

func (*Config) CharSet added in v1.3.5

func (s *Config) CharSet() string

func (*Config) Database

func (s *Config) Database() string

func (*Config) Password

func (s *Config) Password() string

func (*Config) Same

func (s *Config) Same(cfg *Config) bool

func (*Config) Server added in v1.3.0

func (s *Config) Server() string

func (*Config) Username

func (s *Config) Username() string

type Executor

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

Executor Executor

func NewExecutor

func NewExecutor(config *Config) (ret *Executor, err *cd.Result)

NewExecutor 新建一个数据访问对象

func (*Executor) BeginTransaction

func (s *Executor) BeginTransaction() (err *cd.Result)

func (*Executor) CheckTableExist

func (s *Executor) CheckTableExist(tableName string) (ret bool, err *cd.Result)

CheckTableExist Check Table Exist

func (*Executor) CommitTransaction

func (s *Executor) CommitTransaction() (err *cd.Result)

func (*Executor) Connect

func (s *Executor) Connect() (err *cd.Result)

func (*Executor) Execute

func (s *Executor) Execute(sql string, args ...any) (rowsAffected int64, lastInsertID int64, err *cd.Result)

func (*Executor) Finish

func (s *Executor) Finish()

func (*Executor) GetField

func (s *Executor) GetField(value ...interface{}) (err *cd.Result)

func (*Executor) Next

func (s *Executor) Next() bool

func (*Executor) Ping

func (s *Executor) Ping() (err *cd.Result)

func (*Executor) Query

func (s *Executor) Query(sql string, needCols bool, args ...any) (ret []string, err *cd.Result)

func (*Executor) Release

func (s *Executor) Release()

func (*Executor) RollbackTransaction

func (s *Executor) RollbackTransaction() (err *cd.Result)

type OprFunc added in v1.3.4

type OprFunc func(string, model.RawVal, *ResultStack) string

type Pool

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

Pool executorPool

func NewPool

func NewPool() *Pool

NewPool new pool

func (*Pool) CheckConfig

func (s *Pool) CheckConfig(cfgPtr *Config) *cd.Result

func (*Pool) FetchOut added in v1.3.0

func (s *Pool) FetchOut() (ret *Executor, err *cd.Result)

FetchOut FetchOut Executor

func (*Pool) GetExecutor

func (s *Pool) GetExecutor() (ret *Executor, err *cd.Result)

func (*Pool) Initialize

func (s *Pool) Initialize(maxConnNum int, configPtr *Config) (err *cd.Result)

Initialize initialize executor pool

func (*Pool) PutIn added in v1.3.0

func (s *Pool) PutIn(val *Executor)

PutIn PutIn Executor

func (*Pool) Uninitialized added in v1.3.0

func (s *Pool) Uninitialized()

Uninitialized uninitialized executor pool

type ResultStack added in v1.3.161

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

func NewResult added in v1.3.147

func NewResult(sql string, args []any) *ResultStack

func (*ResultStack) Args added in v1.3.161

func (s *ResultStack) Args() []any

func (*ResultStack) PushArgs added in v1.3.161

func (s *ResultStack) PushArgs(arg ...any)

func (*ResultStack) SQL added in v1.3.161

func (s *ResultStack) SQL() string

func (*ResultStack) SetSQL added in v1.3.161

func (s *ResultStack) SetSQL(sql string)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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