internal

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	PInt64   = lib.PInt64
	PUint32  = lib.PUint32
	PInt32   = lib.PInt32
	PInt8    = lib.PInt8
	PInt     = lib.PInt
	PBool    = lib.PBool
	PTime    = lib.PTime
	PTimeNow = lib.PTimeNow
)
View Source
var ErrRecordNotFound = sql.ErrNoRows

Functions

func Create

func Create(dbCtx lib.DBContexter, table string, data ...interface{}) (int64, error)

func Delete

func Delete(dbCtx lib.DBContexter, table string, where interface{}) (int64, error)

func QueryList

func QueryList(dbCtx lib.DBContexter, table string, where interface{}, rst interface{}) error

func QueryOne

func QueryOne(dbCtx lib.DBContexter, table string, where interface{}, rst interface{}) error

func Struct2Assign

func Struct2Assign(raw interface{}) map[string]interface{}

func Struct2AssignList

func Struct2AssignList(raws ...interface{}) []map[string]interface{}

func Struct2Where

func Struct2Where(raw interface{}) map[string]interface{}

func Update

func Update(dbCtx lib.DBContexter, table string, where interface{}, data interface{}) (int64, error)

Types

type DeleteBuilder

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

func (*DeleteBuilder) Compile

func (d *DeleteBuilder) Compile() (sql string, args []interface{}, err error)

func (*DeleteBuilder) From

func (d *DeleteBuilder) From(table string) *DeleteBuilder

func (*DeleteBuilder) Where

func (d *DeleteBuilder) Where(wheres map[string]interface{}) *DeleteBuilder

type InsertBuilder

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

func (*InsertBuilder) Compile

func (i *InsertBuilder) Compile() (sql string, args []interface{}, err error)

func (*InsertBuilder) InsertIgnoreInto

func (i *InsertBuilder) InsertIgnoreInto(table string) *InsertBuilder

func (*InsertBuilder) InsertInto

func (i *InsertBuilder) InsertInto(table string) *InsertBuilder

func (*InsertBuilder) ReplaceInto

func (i *InsertBuilder) ReplaceInto(table string) *InsertBuilder

func (*InsertBuilder) Values

func (i *InsertBuilder) Values(assigns []map[string]interface{}) *InsertBuilder

type SQLBuilder

type SQLBuilder interface {
	Compile() (sql string, args []interface{}, err error)
}

func NewDeleteBuilder

func NewDeleteBuilder(table string, wheres map[string]interface{}) SQLBuilder

func NewIgnoreInsertBuilder

func NewIgnoreInsertBuilder(table string, assigns []map[string]interface{}) SQLBuilder

func NewInsertBuilder

func NewInsertBuilder(table string, assigns []map[string]interface{}) SQLBuilder

func NewReplaceInsertBuilder

func NewReplaceInsertBuilder(table string, assigns []map[string]interface{}) SQLBuilder

func NewSelectBuilder

func NewSelectBuilder(table string, where map[string]interface{}, fields []string) SQLBuilder

func NewUpdateBuilder

func NewUpdateBuilder(table string, wheres map[string]interface{}, assigns map[string]interface{}) SQLBuilder

type SelectBuilder

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

func (*SelectBuilder) Compile

func (s *SelectBuilder) Compile() (sql string, args []interface{}, err error)

func (*SelectBuilder) From

func (s *SelectBuilder) From(table string) *SelectBuilder

func (*SelectBuilder) Select

func (s *SelectBuilder) Select(selectFields []string) *SelectBuilder

func (*SelectBuilder) Where

func (s *SelectBuilder) Where(wheres map[string]interface{}) *SelectBuilder

type UpdateBuilder

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

func (*UpdateBuilder) Assign

func (u *UpdateBuilder) Assign(assign map[string]interface{}) *UpdateBuilder

func (*UpdateBuilder) Compile

func (u *UpdateBuilder) Compile() (sql string, args []interface{}, err error)

func (*UpdateBuilder) From

func (u *UpdateBuilder) From(table string) *UpdateBuilder

func (*UpdateBuilder) Where

func (u *UpdateBuilder) Where(wheres map[string]interface{}) *UpdateBuilder

Jump to

Keyboard shortcuts

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