database

package
v0.9.5 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2024 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDBRecordHasExist = errors.New("记录已存在")
	ErrDBRecordNotExist = errors.New("记录不存在")
)

Functions

func CheckExist

func CheckExist(executor Executor, executeParams *sql.CheckExistExecuteParams) (bool, error)

func CheckHasOnlyOne

func CheckHasOnlyOne(executor Executor, executeParams *sql.CheckHasOnlyOneExecuteParams) (bool, error)

func Count

func Count(executor Executor, executeParams *sql.CountExecuteParams) (int64, error)

func Delete

func Delete(executor Executor, executeParams *sql.DeleteExecuteParams) error

func DeleteEntity

func DeleteEntity(executor Executor, tableName string, e any) error

func ExecuteRawSql

func ExecuteRawSql(executor Executor, sql string, executeParams map[string]any) ([]sql.Result, error)

func ExecuteSql

func ExecuteSql(executor Executor, name string, executeParams map[string]any) ([]sql.Result, error)

func Insert

func Insert(executor Executor, executeParams *sql.InsertExecuteParams) error

func InsertBatch

func InsertBatch(executor Executor, executeParams *sql.InsertBatchExecuteParams) error

func InsertEntity

func InsertEntity(executor Executor, tableName string, e any) error

func InsertEntityBatch

func InsertEntityBatch(executor Executor, tableName string, es []any) error

func IsErrorDBRecordHasExist

func IsErrorDBRecordHasExist(err error) bool

func IsErrorDBRecordNotExist

func IsErrorDBRecordNotExist(err error) bool

func Query

func Query(executor Executor, executeParams *sql.QueryExecuteParams) ([]sql.Result, int64, error)

func QueryOne

func QueryOne(executor Executor, executeParams *sql.QueryOneExecuteParams) (sql.Result, error)

func Transaction

func Transaction(executor Executor, txFunc func(tx Executor) error) error

func Update

func Update(executor Executor, executeParams *sql.UpdateExecuteParams) error

func UpdateEntity

func UpdateEntity(executor Executor, tableName string, e any) error

Types

type Executor

type Executor interface {
	ExecuteRawSql(sql string, executeParams map[string]any) ([]sql.Result, error)
	ExecuteSql(name string, executeParams map[string]any) ([]sql.Result, error)
}

Jump to

Keyboard shortcuts

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