sqlhelper

package
v0.0.0-...-dbefbc8 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompareHash

func CompareHash(pwd string, hash string) bool

CompareHash of a bcrypt hash

func DoSQL

func DoSQL(db *sqlx.DB, stmt string, args ...interface{}) error

DoSQL executes a sql statement

func Hash

func Hash(pwd string) (string, error)

Hash a password with bcrypt

func IToB

func IToB(b bool) int

IToB converts a boolean to integer

func NewDatabase

func NewDatabase() *sqlx.DB

NewDatabase creates a new connection for sql.storage

func NewTestDatabase

func NewTestDatabase() *sqlx.DB

NewTestDatabase creates a connection to a test database on 127.0.0.1:3306 with no password

func RetryExec

func RetryExec(db *sqlx.DB, sql string, args ...interface{}) (int64, error)

RetryExec retries the exec until we get no error (deadlocks)

func RetryExecTillNoRows

func RetryExecTillNoRows(db *sqlx.DB, sql string, args ...interface{}) error

RetryExecTillNoRows retries the exec until we get no error (deadlocks) and no results are returned

func RetryTransaction

func RetryTransaction(tx *sqlx.Tx) error

RetryTransaction on deadlocks

Types

This section is empty.

Jump to

Keyboard shortcuts

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