db

package
v1.1.14 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create() *srDb

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(cli *clog.Instance, whereQuery, endQuery string, wherePars ...interface{}) (int, error)

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

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

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

func (slf *Repo[T]) Execute(cli *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(cli *clog.Instance, whereQuery string, endQuery string, wherePars ...interface{}) (*T, error)

func (*Repo[T]) GetDatas

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

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

func (slf *Repo[T]) Insert(cli *clog.Instance, sqlPars ...interface{}) 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(cli *clog.Instance, query string, pars ...interface{}) (int, error)

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

func (slf *Repo[T]) Select(cli *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]) Update

func (slf *Repo[T]) Update(cli *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