dbcl

package
v0.0.0-...-5ed304f Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertDurationToInterval

func ConvertDurationToInterval(duration time.Duration) string

func ExecBulkInsert

func ExecBulkInsert(q Querier, table string, cols []string, objects []interface{}) error

func ExecBulkInsertUpdateAdd

func ExecBulkInsertUpdateAdd(
	q Querier,
	table string,
	insertCols, updateCols []string,
	objects []interface{},
) error

func ExecBulkInsertUpdateOverwrite

func ExecBulkInsertUpdateOverwrite(
	q Querier,
	table string,
	insertCols, updateCols []string,
	objects []interface{},
) error

func ExecBulkInsertUpdateSubtract

func ExecBulkInsertUpdateSubtract(
	q Querier,
	table string,
	insertCols, updateCols []string,
	objects []interface{},
) error

func ExecInsert

func ExecInsert(q Querier, table string, cols []string, object interface{}) (uint64, error)

func ExecInsertNoID

func ExecInsertNoID(q Querier, table string, cols []string, object interface{}) error

func ExecUpdate

func ExecUpdate(
	q Querier,
	table string,
	updateCols, whereCols []string,
	updatedAt bool,
	obj interface{},
) error

func FetchMigrations

func FetchMigrations(path string, migrationFS *embed.FS) (map[string]string, error)

func GetBigInt

func GetBigInt(q Querier, query string, args ...interface{}) (*big.Int, error)

func GetFloat64

func GetFloat64(q Querier, query string, args ...interface{}) (float64, error)

func GetString

func GetString(q Querier, query string, args ...interface{}) (string, error)

func GetTime

func GetTime(q Querier, query string, args ...interface{}) (time.Time, error)

func GetUint64

func GetUint64(q Querier, query string, args ...interface{}) (uint64, error)

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func New

func New(
	writeHost, readHost, port, name, user, pass string,
	migrations map[string]string,
) (*Client, error)

func (*Client) Begin

func (c *Client) Begin() (*Tx, error)

func (*Client) Close

func (c *Client) Close()

func (*Client) DowngradeMigration

func (c *Client) DowngradeMigration() error

func (*Client) DowngradeMigrations

func (c *Client) DowngradeMigrations() error

func (*Client) Ping

func (c *Client) Ping() error

func (*Client) Reader

func (c *Client) Reader() *sqlx.DB

func (*Client) UpgradeMigrations

func (c *Client) UpgradeMigrations() error

func (*Client) Writer

func (c *Client) Writer() *sqlx.DB

type NullBigInt

type NullBigInt struct {
	BigInt *big.Int
	Valid  bool
}

func (*NullBigInt) Scan

func (n *NullBigInt) Scan(src interface{}) error

Scan implements the Scanner interface.

func (NullBigInt) Value

func (n NullBigInt) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type Querier

type Querier interface {
	Get(dest interface{}, query string, args ...interface{}) error
	Select(dest interface{}, query string, args ...interface{}) error
	Exec(query string, args ...interface{}) (sql.Result, error)
	NamedExec(query string, arg interface{}) (sql.Result, error)
	Rebind(query string) string
}

type Tx

type Tx struct {
	sqlx.Tx
	// contains filtered or unexported fields
}

func NewTx

func NewTx(tx *sqlx.Tx) *Tx

func (*Tx) SafeCommit

func (tx *Tx) SafeCommit() error

func (*Tx) SafeRollback

func (tx *Tx) SafeRollback() error

Jump to

Keyboard shortcuts

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