db

package
v0.0.0-...-1a5fb70 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2023 License: Apache-2.0 Imports: 9 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DB *sql.DB

Functions

func Delete

func Delete(table, id string) error

func DeleteTx

func DeleteTx(tx *sql.Tx, table, id string) error

func Get

func Get(table string, kvs map[string]interface{}, obj interface{}) error

https://dev.mysql.com/doc/refman/5.7/en/json.html#json-paths

func GetById

func GetById(table string, id string, obj interface{}) error

func Insert

func Insert(table string, obj interface{}) error

func InsertIfNotExist

func InsertIfNotExist(table, id string, obj interface{}) error

func InsertTx

func InsertTx(tx *sql.Tx, table string, obj interface{}) error

func List

func List(field, table string, result interface{}, clause string, args ...interface{}) error

func ToJSON

func ToJSON(obj interface{}) (string, error)

func Update

func Update(table, id string, newObj interface{}) error

func UpdateKVS

func UpdateKVS(table, id string, kvs map[string]interface{}) error

string|int value works for now

func UpdateTx

func UpdateTx(tx *sql.Tx, table, id string, newObj interface{}) error

func UpdateUUId

func UpdateUUId(table, uuId string, kvs map[string]interface{}) error

func Upsert

func Upsert(table, id string, obj interface{}) error

Update||Insert

Types

This section is empty.

Jump to

Keyboard shortcuts

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