Help us shape the future of Go! Take the 2026 Go Developer Survey

pgc

package
v0.5.9 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OpInsert    = "INSERT"
	OpSelectAll = "SELECT_ALL"
	OpSelect    = "SELECT"
	OpUpdate    = "UPDATE"
	OpDelete    = "DELETE"
)

Variables

View Source
var (
	ErrDuplicateKey        = errors.New("duplicate key")
	ErrCheckViolation      = errors.New("check constraint violation")
	ErrForeignKeyViolation = errors.New("foreign key violation")
)

Functions

func CheckError

func CheckError(err error) error

Types

type Client

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

func NewClient

func NewClient(logger log.Logger, dbc *db.Client) (*Client, error)

NewClient wraps salt/db client

func (*Client) Close

func (c *Client) Close() error

Close closes the database connection

func (*Client) Commit

func (c *Client) Commit(ctx context.Context) error

func (*Client) ExecContext

func (c *Client) ExecContext(ctx context.Context, op string, tableName string, query string, args ...interface{}) (sql.Result, error)

func (*Client) GetContext

func (c *Client) GetContext(ctx context.Context, op string, tableName string, dest interface{}, query string, args ...interface{}) error

func (*Client) GetDB

func (c *Client) GetDB(ctx context.Context) sqlx.QueryerContext

func (*Client) NamedExecContext

func (c *Client) NamedExecContext(ctx context.Context, op string, tableName string, query string, arg interface{}) (sql.Result, error)

func (*Client) QueryRowxContext

func (c *Client) QueryRowxContext(ctx context.Context, op string, tableName string, query string, args ...interface{}) *sqlx.Row

func (*Client) QueryxContext

func (c *Client) QueryxContext(ctx context.Context, op string, tableName string, query string, args ...interface{}) (*sqlx.Rows, error)

func (*Client) Rollback

func (c *Client) Rollback(ctx context.Context) error

func (*Client) WithTransaction

func (c *Client) WithTransaction(ctx context.Context, opts *sql.TxOptions) context.Context

type StringInterfaceMap

type StringInterfaceMap map[string]interface{}

func (*StringInterfaceMap) Scan

func (m *StringInterfaceMap) Scan(value interface{}) error

func (StringInterfaceMap) Value

func (a StringInterfaceMap) Value() (driver.Value, error)

type StringStringMap

type StringStringMap map[string]string

func (*StringStringMap) Scan

func (m *StringStringMap) Scan(value interface{}) error

func (StringStringMap) Value

func (a StringStringMap) Value() (driver.Value, error)

type TimeDuration added in v0.5.8

type TimeDuration time.Duration

func (*TimeDuration) Scan added in v0.5.8

func (t *TimeDuration) Scan(value interface{}) error

func (TimeDuration) Value added in v0.5.8

func (t TimeDuration) Value() (driver.Value, error)

Jump to

Keyboard shortcuts

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