db

package
v1.1.21 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create() *srDb

func GetUpdateHelper added in v1.1.21

func GetUpdateHelper() abs.DbGetUpdateHelper

func NewUpdateHelper added in v1.1.21

func NewUpdateHelper() abs.DbUpdateHelper

Types

type Repo

type Repo[T any] struct {
	DbInstance        abs.DbInstance
	TableName         string
	ColumnNames       string
	InsertColumnNames string // if empty then use columnNames
	ParamSigns        string
	InsertParamSign   string // if empty then use paramSigns
	PrintUnsafeErr    bool
}

func (*Repo[T]) Count added in v1.0.3

func (slf *Repo[T]) Count(logc *clog.Instance, whereQuery, endQuery string, wherePars ...interface{}) (int, error)

func (*Repo[T]) Delete added in v1.0.3

func (slf *Repo[T]) Delete(logc *clog.Instance, whereQuery string, wherePars ...interface{}) error

func (*Repo[T]) Execute added in v1.0.3

func (slf *Repo[T]) Execute(logc *clog.Instance, sqlQuery string, sqlPars ...interface{}) error

func (*Repo[T]) GenerateParamSigns

func (slf *Repo[T]) GenerateParamSigns(columnNames string) (paramSign string)

func (*Repo[T]) GetData

func (slf *Repo[T]) GetData(logc *clog.Instance, whereQuery string, endQuery string, wherePars ...interface{}) (*T, error)

func (*Repo[T]) GetDatas

func (slf *Repo[T]) GetDatas(logc *clog.Instance, whereQuery string, endQuery string, wherePars ...interface{}) ([]T, error)

func (*Repo[T]) Insert added in v1.0.5

func (slf *Repo[T]) Insert(logc *clog.Instance, sqlPars ...interface{}) error

func (*Repo[T]) InsertRID added in v1.1.18

func (slf *Repo[T]) InsertRID(logc *clog.Instance, sqlPars ...interface{}) (*int64, error)

func (*Repo[T]) OnUnsafe

func (slf *Repo[T]) OnUnsafe(unsafe *model.DbUnsafeSelectError)

func (*Repo[T]) RawCount added in v1.1.13

func (slf *Repo[T]) RawCount(logc *clog.Instance, query string, pars ...interface{}) (int, error)

func (*Repo[T]) Select added in v1.1.13

func (slf *Repo[T]) Select(logc *clog.Instance, query string, args ...interface{}) ([]T, error)

func (*Repo[T]) SelectFirst added in v1.1.15

func (slf *Repo[T]) SelectFirst(logc *clog.Instance, query string, args ...interface{}) (*T, error)

func (*Repo[T]) SetColumnNames added in v1.0.3

func (slf *Repo[T]) SetColumnNames(names string)

func (*Repo[T]) SetInsertColumnNames added in v1.0.3

func (slf *Repo[T]) SetInsertColumnNames(names string)

func (*Repo[T]) TxCount added in v1.1.18

func (slf *Repo[T]) TxCount(logc *clog.Instance, tx abs.DbTx, whereQuery, endQuery string, wherePars ...interface{}) (int, error)

func (*Repo[T]) TxDelete added in v1.1.18

func (slf *Repo[T]) TxDelete(logc *clog.Instance, tx abs.DbTx, whereQuery string, wherePars ...interface{}) error

func (*Repo[T]) TxExecute added in v1.1.18

func (slf *Repo[T]) TxExecute(logc *clog.Instance, tx abs.DbTx, sqlQuery string, sqlPars ...interface{}) error

func (*Repo[T]) TxGetData added in v1.1.18

func (slf *Repo[T]) TxGetData(logc *clog.Instance, tx abs.DbTx, whereQuery string, endQuery string, wherePars ...interface{}) (*T, error)

func (*Repo[T]) TxGetDatas added in v1.1.18

func (slf *Repo[T]) TxGetDatas(logc *clog.Instance, tx abs.DbTx, whereQuery string, endQuery string, wherePars ...interface{}) ([]T, error)

func (*Repo[T]) TxInsert added in v1.1.18

func (slf *Repo[T]) TxInsert(logc *clog.Instance, tx abs.DbTx, sqlPars ...interface{}) error

func (*Repo[T]) TxInsertRID added in v1.1.18

func (slf *Repo[T]) TxInsertRID(logc *clog.Instance, tx abs.DbTx, sqlPars ...interface{}) (*int64, error)

func (*Repo[T]) TxRawCount added in v1.1.18

func (slf *Repo[T]) TxRawCount(logc *clog.Instance, tx abs.DbTx, query string, pars ...interface{}) (int, error)

func (*Repo[T]) TxSelect added in v1.1.18

func (slf *Repo[T]) TxSelect(logc *clog.Instance, tx abs.DbTx, query string, args ...interface{}) ([]T, error)

func (*Repo[T]) TxSelectFirst added in v1.1.18

func (slf *Repo[T]) TxSelectFirst(logc *clog.Instance, tx abs.DbTx, query string, args ...interface{}) (*T, error)

func (*Repo[T]) TxUpdate added in v1.1.18

func (slf *Repo[T]) TxUpdate(logc *clog.Instance, tx abs.DbTx, keyVals map[string]interface{}, whereQuery string, wherePars ...interface{}) error

func (*Repo[T]) Update

func (slf *Repo[T]) Update(logc *clog.Instance, keyVals map[string]interface{}, whereQuery string, wherePars ...interface{}) error

type View added in v1.0.15

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

func (*View) New added in v1.0.15

func (slf *View) New(db abs.DbInstance, printUnsafeErr bool) *View

func (*View) Select added in v1.0.15

func (slf *View) Select(out interface{}, sqlQuery string, sqlPars ...interface{}) error

Jump to

Keyboard shortcuts

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