database

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DisableLogger disableLoggerType = 1
	EnableLogger  disableLoggerType = 0
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DBDriver

type DBDriver string
const (
	DBDriverPostgres DBDriver = "pgx"
)

type DBconnector

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

func NewDBConnector

func NewDBConnector(connString string, dbDriver DBDriver, logger logr.Logger) *DBconnector

func (*DBconnector) Close

func (d *DBconnector) Close(ctx context.Context) error

func (*DBconnector) Connect

func (d *DBconnector) Connect(ctx context.Context) error

func (*DBconnector) Exec

func (d *DBconnector) Exec(ctx context.Context, q string, args ...any) error

func (*DBconnector) ExecTx

func (d *DBconnector) ExecTx(ctx context.Context, queryList []Query, namedQuery []NamedQuery, disableArg ...any) error

func (*DBconnector) Get

func (d *DBconnector) Get(ctx context.Context, dest any, quer string, args ...any) error

func (*DBconnector) MapperFunc

func (d *DBconnector) MapperFunc(tagName string, f func(string) string)

func (*DBconnector) NamedExec

func (d *DBconnector) NamedExec(ctx context.Context, q NamedQuery, disableArg ...any) error

func (*DBconnector) NamedQuery

func (d *DBconnector) NamedQuery(ctx context.Context, q NamedQuery, disableArg ...any) (*sqlx.Rows, error)

func (*DBconnector) Query

func (d *DBconnector) Query(ctx context.Context, q string, args ...any) (*sqlx.Rows, error)

func (*DBconnector) Select

func (d *DBconnector) Select(ctx context.Context, dest any, quer string, args ...any) error

type NamedQuery

type NamedQuery struct {
	Query string
	Arg   any
}

type PostgresSSLMode

type PostgresSSLMode string
const (
	SSLModeDISABLE    PostgresSSLMode = "disable"
	SSLModeALLOW      PostgresSSLMode = "allow"
	SSLModePREFER     PostgresSSLMode = "prefer"
	SSLModeREQUIRE    PostgresSSLMode = "require"
	SSLModeVERIFYCA   PostgresSSLMode = "verify-ca"
	SSLModeVERIFYFULL PostgresSSLMode = "verify-full"
)

type Query

type Query struct {
	Query string
	Args  []any
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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