database

package
v2.11.0 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2022 License: GPL-3.0 Imports: 21 Imported by: 2

Documentation

Index

Constants

View Source
const (
	SchemaParam = "db_schema"
)

Variables

View Source
var (
	ErrNotConnected = errors.New("db: not connected")
)

Functions

func NewDbConnection

func NewDbConnection(config structure.DBConfiguration) (*pg.DB, error)

func NewLogQueryHook

func NewLogQueryHook(level logrus.Level) pg.QueryHook

func ResolveMigrationsDirectory

func ResolveMigrationsDirectory() string

func RunInTransactionV2

func RunInTransactionV2(pdb *pg.DB, f interface{}) error

Types

type ErrorEvent

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

func (ErrorEvent) Error

func (er ErrorEvent) Error() string

type JsoniterProvider added in v2.3.1

type JsoniterProvider struct {
}

func (JsoniterProvider) Marshal added in v2.3.1

func (s JsoniterProvider) Marshal(v interface{}) ([]byte, error)

func (JsoniterProvider) NewDecoder added in v2.3.1

func (s JsoniterProvider) NewDecoder(r io.Reader) pgjson.Decoder

func (JsoniterProvider) NewEncoder added in v2.3.1

func (s JsoniterProvider) NewEncoder(w io.Writer) pgjson.Encoder

func (JsoniterProvider) Unmarshal added in v2.3.1

func (s JsoniterProvider) Unmarshal(data []byte, v interface{}) error

type Option

type Option func(rdc *RxDbClient)

func WithInitializingErrorHandler

func WithInitializingErrorHandler(eh errorHandler) Option

func WithInitializingHandler

func WithInitializingHandler(handler initHandler) Option

func WithMigrationsEnsuring

func WithMigrationsEnsuring() Option

func WithQueryHooks

func WithQueryHooks(qhs ...pg.QueryHook) Option

func WithSchemaAutoInjecting

func WithSchemaAutoInjecting() Option

func WithSchemaEnsuring

func WithSchemaEnsuring() Option

type RxDbClient

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

func NewRxDbClient

func NewRxDbClient(opts ...Option) *RxDbClient

func (*RxDbClient) Close

func (rc *RxDbClient) Close() error

func (*RxDbClient) ReceiveConfiguration

func (rc *RxDbClient) ReceiveConfiguration(config structure.DBConfiguration)

func (*RxDbClient) RunInTransaction

func (rc *RxDbClient) RunInTransaction(f interface{}) error

func (*RxDbClient) Unsafe

func (rc *RxDbClient) Unsafe() *pg.DB

func (*RxDbClient) Visit

func (rc *RxDbClient) Visit(v visitor) error

Jump to

Keyboard shortcuts

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