pgc

package
v0.7.4 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

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, cfg db.Config) (*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, query string, args ...interface{}) (sql.Result, error)

func (*Client) GetContext

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

func (*Client) GetDB

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

func (*Client) GetSaltDB added in v0.6.12

func (c *Client) GetSaltDB(ctx context.Context) *db.Client

func (*Client) NamedExecContext

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

func (*Client) QueryRowxContext

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

func (*Client) QueryxContext

func (c *Client) QueryxContext(ctx context.Context, 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 ListStringStringMap added in v0.7.0

type ListStringStringMap []map[string]string

func (*ListStringStringMap) Scan added in v0.7.0

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

func (ListStringStringMap) Value added in v0.7.0

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

type StringAnyMap added in v0.6.4

type StringAnyMap map[string]any

func (*StringAnyMap) Scan added in v0.6.4

func (m *StringAnyMap) Scan(value any) error

func (StringAnyMap) Value added in v0.6.4

func (a StringAnyMap) 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

type TimeDuration time.Duration

func (*TimeDuration) Scan

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

func (TimeDuration) Value

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