database

package
v0.0.0-...-b00f800 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2021 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Exec

func Exec(pool Pool, ctx iris.Context, query sqrl.Sqlizer) (pgconn.CommandTag, error)

func ExecWithTimeout

func ExecWithTimeout(pool Pool, ctx iris.Context, timeout time.Duration, query sqrl.Sqlizer) (pgconn.CommandTag, error)

func Query

func Query(pool Pool, ctx iris.Context, query sqrl.Sqlizer) (pgx.Rows, error)

func QueryBuilder

func QueryBuilder() sqrl.StatementBuilderType

func QueryFunc

func QueryFunc(pool Pool, ctx iris.Context, query sqrl.Sqlizer, fn RowFunction) error

func QueryFuncWithTimeout

func QueryFuncWithTimeout(pool Pool, ctx iris.Context, timeout time.Duration, query sqrl.Sqlizer, fn RowFunction) error

func QueryRow

func QueryRow(pool Pool, ctx iris.Context, query sqrl.Sqlizer) pgx.Row

func QueryRowWithTimeout

func QueryRowWithTimeout(pool Pool, ctx iris.Context, timeout time.Duration, query sqrl.Sqlizer) pgx.Row

func QueryWithTimeout

func QueryWithTimeout(pool Pool, ctx iris.Context, timeout time.Duration, query sqrl.Sqlizer) (pgx.Rows, error)

func UuidArray

func UuidArray(array []uuid.UUID) []string

func ValueByDataType

func ValueByDataType(value, datatype string) (interface{}, error)

Types

type Datatype

type Datatype string
const (
	Float     Datatype = "float"
	Int       Datatype = "int"
	String    Datatype = "string"
	Timestamp Datatype = "timestamp"
	Uint      Datatype = "uint"
)

type Pool

type Pool interface {
	Exec(ctx context.Context, sql string, args ...interface{}) (pgconn.CommandTag, error)
	Query(ctx context.Context, sql string, args ...interface{}) (pgx.Rows, error)
	QueryRow(ctx context.Context, sql string, args ...interface{}) pgx.Row
	Begin(ctx context.Context) (pgxpool.Tx, error)
}

func NewDatabasePool

func NewDatabasePool(sensor *instana.Sensor) (Pool, error)

type RowFunction

type RowFunction = func(row pgx.Row) error

Jump to

Keyboard shortcuts

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