Documentation ¶
Index ¶
- func ExecInTx(db *sql.DB, opts *sql.TxOptions, initFn func(*sql.Tx) error, ...) (ret interface{}, err error)
- func GetAllKeysFromTable(tx *sql.Tx, table string) ([]string, error)
- func GetAllValuesFromTable(tx *sql.Tx, table string) (map[string][]byte, error)
- func GetEnvWithDefault(variable string, defaultValue string) string
- func GetTableName(networkId string, baseName string) string
- func MigrateNetworkAgnosticServiceToBlobstore(nid, typ, oldTable, newTable string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExecInTx ¶
func ExecInTx( db *sql.DB, opts *sql.TxOptions, initFn func(*sql.Tx) error, txFn func(*sql.Tx) (interface{}, error), ) (ret interface{}, err error)
ExecInTx executes a callback inside a sql transaction on the provided DB. The transaction is rolled back if any error is encountered. initFn is a callback to call before the main txFn, commonly used in our codebase to execute a CREATE TABLE IF NOT EXISTS. Copied from orc8r/cloud/go/sqorc/tx.go.
func GetAllValuesFromTable ¶
If the table DNE, log and return empty map
func GetEnvWithDefault ¶
func GetTableName ¶
func MigrateNetworkAgnosticServiceToBlobstore ¶
func MigrateNetworkAgnosticServiceToBlobstore(nid, typ, oldTable, newTable string)
MigrateNetworkAgnosticServiceToBlobstore migrates a network-agnostic service's data from datastore to blobstore formats.
Schema migration:
- Datastore has cols
- key
- value
- generation_number
- deleted
- Blobstore has cols
- network_id
- type
- key
- value
- version
- Conversion (blobstore col <- datastore col)
- network_id <- [nid parameter]
- type <- [typ parameter]
- key <- key
- value <- value
- version <- generation_number
- n/a <- deleted
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.