datastore

package
v0.0.0-...-c307d98 Latest Latest
Warning

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

Go to latest
Published: May 10, 2023 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewPostgresDatastore

func NewPostgresDatastore(
	ctx context.Context,
	logger logger.Logger,
	user, password, host string,
	port int,
	name, sslMode string,
) (*PostgresDatastore, CloseFunc)

Types

type CloseFunc

type CloseFunc func() error

type Datastore

type Datastore interface {
	BeginTx(ctx context.Context, opts *sql.TxOptions) (*sql.Tx, error)
	Exec(query string, args ...any) (sql.Result, error)
	ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error)
	Prepare(query string) (*sql.Stmt, error)
	PrepareContext(ctx context.Context, query string) (*sql.Stmt, error)
	Query(query string, args ...any) (*sql.Rows, error)
	QueryContext(ctx context.Context, query string, args ...any) (*sql.Rows, error)
	QueryRow(query string, args ...any) *sql.Row
	QueryRowContext(ctx context.Context, query string, args ...any) *sql.Row
}

type PostgresDatastore

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

func (*PostgresDatastore) BeginTx

func (p *PostgresDatastore) BeginTx(ctx context.Context, opts *sql.TxOptions) (*sql.Tx, error)

func (*PostgresDatastore) Exec

func (p *PostgresDatastore) Exec(query string, args ...any) (sql.Result, error)

func (*PostgresDatastore) ExecContext

func (p *PostgresDatastore) ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error)

func (*PostgresDatastore) Prepare

func (p *PostgresDatastore) Prepare(query string) (*sql.Stmt, error)

func (*PostgresDatastore) PrepareContext

func (p *PostgresDatastore) PrepareContext(ctx context.Context, query string) (*sql.Stmt, error)

func (*PostgresDatastore) Query

func (p *PostgresDatastore) Query(query string, args ...any) (*sql.Rows, error)

func (*PostgresDatastore) QueryContext

func (p *PostgresDatastore) QueryContext(ctx context.Context, query string, args ...any) (*sql.Rows, error)

func (*PostgresDatastore) QueryRow

func (p *PostgresDatastore) QueryRow(query string, args ...any) *sql.Row

func (*PostgresDatastore) QueryRowContext

func (p *PostgresDatastore) QueryRowContext(ctx context.Context, query string, args ...any) *sql.Row

Jump to

Keyboard shortcuts

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