Documentation
¶
Index ¶
- func Delete(pool *pool.DbPool, sql *string, args ...interface{}) (sql.Result, error)
- func Insert(pool *pool.DbPool, sql *string, args ...any) (sql.Result, error)
- func NamedDelete(pool *pool.DbPool, sql *string, args *map[string]interface{}) (sql.Result, error)
- func NamedInsert(pool *pool.DbPool, sql *string, args *map[string]interface{}) (sql.Result, error)
- func NamedUpdate(pool *pool.DbPool, sql *string, args *map[string]interface{}) (sql.Result, error)
- func NextSeqMargin(pool *pool.DbPool, sqlSelect *string, sqlUpdate *string, seqName string) (map[string]interface{}, error)
- func SelectAsJson(pool *pool.DbPool, sql *string, args ...interface{}) ([]byte, error)
- func SelectAsJsonArray(pool *pool.DbPool, sql *string, args ...interface{}) ([]byte, error)
- func SelectAsMap(pool *pool.DbPool, sql *string, args ...interface{}) (map[string]interface{}, error)
- func SelectAsMapSlice(pool *pool.DbPool, sql *string, args ...interface{}) ([]interface{}, error)
- func SelectAsObject(pool *pool.DbPool, outObject interface{}, sql *string, args ...interface{}) error
- func SelectAsSlice(pool *pool.DbPool, outSlice interface{}, sql *string, args ...interface{}) error
- func TxDelete(pool *pool.DbPool, sql *string, args ...interface{}) (sql.Result, error)
- func TxInsert(pool *pool.DbPool, sql *string, args ...any) (sql.Result, error)
- func TxNamedDelete(pool *pool.DbPool, sql *string, args *map[string]interface{}) (sql.Result, error)
- func TxNamedInsert(pool *pool.DbPool, sql *string, args *map[string]interface{}) (sql.Result, error)
- func TxNamedUpdate(pool *pool.DbPool, sql *string, args *map[string]interface{}) (sql.Result, error)
- func TxSelectAsMap(pool *pool.DbPool, sql *string, args ...interface{}) (map[string]interface{}, error)
- func TxSelectAsMapSlice(pool *pool.DbPool, sql *string, args ...interface{}) ([]interface{}, error)
- func TxSelectAsObject(pool *pool.DbPool, outObject interface{}, sql *string, args ...interface{}) error
- func TxSelectAsSlice(pool *pool.DbPool, outSlice interface{}, sql *string, args ...interface{}) error
- func TxUpdate(pool *pool.DbPool, sql *string, args ...interface{}) (sql.Result, error)
- func Update(pool *pool.DbPool, sql *string, args ...interface{}) (sql.Result, error)
- func UpdateOri(db *sqlx.DB, sql *string, args ...interface{}) (sql.Result, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Insert ¶
for insert with param list bind with ?
"INSERT INTO person (first_name, last_name, email) VALUES (?, ?, ?)"
func NamedInsert ¶
for insert with named param bind:
"INSERT INTO person (first_name, last_name, email) VALUES (:first, :last, :email)"
func NamedUpdate ¶
for update with named param bind:
"update person set first_name = :first, last_name = :last, email = :email where id = :id"
func NextSeqMargin ¶
func SelectAsJson ¶
func SelectAsJsonArray ¶
func SelectAsMap ¶
func SelectAsMap(pool *pool.DbPool, sql *string, args ...interface{}) (map[string]interface{}, error)
for select single row, return result as map[string]interface{}
resMap, err := SelectAsMap(db, &slice, "SELECT * FROM person WHERE first_name=?", "Jason")
func SelectAsMapSlice ¶
for select multi row, return result as []map[string]interface{}
sliceMap, err := SelectAsMapSlice(db, sql, "SELECT * FROM person WHERE first_name=?", "Jason")
func SelectAsObject ¶
func SelectAsObject(pool *pool.DbPool, outObject interface{}, sql *string, args ...interface{}) error
for select single row, return outObject automatic reflect to dest struct
obj := Person{} err := crud.SelectAsObject(db, &obj, "SELECT * FROM person WHERE first_name=?", "Jason")
func SelectAsSlice ¶
for select multi rows, return outSlice automatic reflect to dest struct
slice := []Person{} err := SelectAsSlice(db, &slice, "SELECT * FROM person ORDER BY first_name ASC")
func TxNamedDelete ¶
func TxNamedInsert ¶
func TxNamedUpdate ¶
func TxSelectAsMap ¶
func TxSelectAsMapSlice ¶
func TxSelectAsObject ¶
func TxSelectAsSlice ¶
func TxSelectAsSlice(pool *pool.DbPool, outSlice interface{}, sql *string, args ...interface{}) error
select with transaction
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.