db

package
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2024 License: MIT Imports: 17 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 FetchOpt added in v1.1.55

type FetchOpt struct {
	EndQuery               string
	WithoutDeletedAtIsNull bool
}

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
}

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]) CountBy added in v1.1.46

func (slf *Repo[T]) CountBy(logc *clog.Instance, condition, end string, pars ...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]) DeleteBy added in v1.1.46

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

func (*Repo[T]) DoUpdate added in v1.1.55

func (slf *Repo[T]) DoUpdate(logc *clog.Instance, keyVals map[string]interface{}, 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]) Fetch added in v1.1.55

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

func (*Repo[T]) Fetches added in v1.1.55

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

func (*Repo[T]) GenerateParamSigns

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

func (*Repo[T]) GetBy added in v1.1.46

func (slf *Repo[T]) GetBy(logc *clog.Instance, condition, end string, pars ...interface{}) (*T, error)

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]) GetsBy added in v1.1.46

func (slf *Repo[T]) GetsBy(logc *clog.Instance, condition, end string, pars ...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]) RawCount added in v1.1.13

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

func (*Repo[T]) RawFCT added in v1.1.32

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

func (*Repo[T]) RawFloat64 added in v1.1.32

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

func (*Repo[T]) RawInt added in v1.1.32

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

func (*Repo[T]) RawInt64 added in v1.1.32

func (slf *Repo[T]) RawInt64(logc *clog.Instance, query string, pars ...interface{}) (int64, 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]) Sum added in v1.1.46

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

func (*Repo[T]) SumBy added in v1.1.46

func (slf *Repo[T]) SumBy(logc *clog.Instance, column, condition, end string, pars ...interface{}) (fc.FCT, error)

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]) TxCountBy added in v1.1.46

func (slf *Repo[T]) TxCountBy(logc *clog.Instance, tx abs.DbTx, condition, end string, pars ...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]) TxDeleteBy added in v1.1.46

func (slf *Repo[T]) TxDeleteBy(logc *clog.Instance, tx abs.DbTx, condition string, pars ...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]) TxGetBy added in v1.1.46

func (slf *Repo[T]) TxGetBy(logc *clog.Instance, tx abs.DbTx, condition, end string, pars ...interface{}) (*T, 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]) TxGetsBy added in v1.1.46

func (slf *Repo[T]) TxGetsBy(logc *clog.Instance, tx abs.DbTx, condition, end string, pars ...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]) TxRawFCT added in v1.1.32

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

func (*Repo[T]) TxRawFloat64 added in v1.1.32

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

func (*Repo[T]) TxRawInt added in v1.1.32

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

func (*Repo[T]) TxRawInt64 added in v1.1.32

func (slf *Repo[T]) TxRawInt64(logc *clog.Instance, tx abs.DbTx, query string, pars ...interface{}) (int64, 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]) TxSum added in v1.1.46

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

func (*Repo[T]) TxSumBy added in v1.1.46

func (slf *Repo[T]) TxSumBy(logc *clog.Instance, tx abs.DbTx, column, condition, end string, pars ...interface{}) (fc.FCT, 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]) TxUpdateBy added in v1.1.46

func (slf *Repo[T]) TxUpdateBy(logc *clog.Instance, tx abs.DbTx, set, condition string, pars ...interface{}) error

func (*Repo[T]) Update

func (slf *Repo[T]) Update(logc *clog.Instance, sr Update) error

func (*Repo[T]) UpdateBy added in v1.1.46

func (slf *Repo[T]) UpdateBy(logc *clog.Instance, set, condition string, pars ...interface{}) error

type Update added in v1.1.55

type Update struct {
	Set       string
	Where     string
	SetPars   []interface{}
	WherePars []interface{}
}

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