dbutil

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const CREATE_DATA_TABLE = `CREATE TABLE "{{TABLE_NAME}}" (
	"{{ENTITY_NAME}}" VARCHAR({{ENTITY_LENGTH}}) PRIMARY KEY,
	{{COLUMN_DEFS}});
`

Variables

This section is empty.

Functions

func BuildConditions

func BuildConditions(equal map[string]interface{}, in map[string]interface{}) ([]string, []interface{}, error)

func BuildFeatureDataTableSchema

func BuildFeatureDataTableSchema(tableName string, entity *types.Entity, features types.FeatureList) string

func InsertRecordsToTable added in v0.0.2

func InsertRecordsToTable(db *sqlx.DB, ctx context.Context, tableName string, records []interface{}, columns []string) error

func InsertRecordsToTableTx added in v0.0.2

func InsertRecordsToTableTx(tx *sqlx.Tx, ctx context.Context, tableName string, records []interface{}, columns []string) error

func Quote

func Quote(quote string, fields ...string) string

func TempTable added in v0.0.2

func TempTable(prefix string) string

func WithTransaction

func WithTransaction(db *sqlx.DB, ctx context.Context, fn TxFn) (err error)

Types

type RowMap

type RowMap = map[string]interface{}

type TxFn

type TxFn func(ctx context.Context, tx *sqlx.Tx) error

A Txfn is a function that will be called with an initialized `Transaction` object that can be used for executing statements and queries against a database.

Jump to

Keyboard shortcuts

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