database

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func DoMigration

func DoMigration(logger logging.Logger, dbURL, devDbURL *url.URL, DesiredURLs []*url.URL) error

func GetDatabaseURL

func GetDatabaseURL(env config.Env) (*url.URL, error)

func GetDevDatabaseURL

func GetDevDatabaseURL(env config.Env) (*url.URL, error)

func GetSchemaURL

func GetSchemaURL() []*url.URL

GetSchemaURL Add in v2, get value from ENV

Types

type Database

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

Database structure

func NewDatabase

func NewDatabase(lx fx.Lifecycle, logger logging.Logger, env config.Env) (*Database, repository.DBTX)

NewDatabase Saves a new database instance

func (Database) Begin added in v0.1.1

func (db Database) Begin(ctx context.Context) (pgx.Tx, error)

func (Database) Exec

func (db Database) Exec(ctx context.Context, sql string, args ...interface{}) (pgconn.CommandTag, error)

func (Database) Query

func (db Database) Query(ctx context.Context, sql string, args ...interface{}) (pgx.Rows, error)

func (Database) QueryRow

func (db Database) QueryRow(ctx context.Context, sql string, args ...interface{}) pgx.Row

type Tx added in v0.1.1

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

func (*Tx) Begin added in v0.1.1

func (tx *Tx) Begin(ctx context.Context) (pgx.Tx, error)

func (*Tx) Commit added in v0.1.1

func (tx *Tx) Commit(ctx context.Context) error

func (*Tx) Conn added in v0.1.1

func (tx *Tx) Conn() *pgx.Conn

func (*Tx) CopyFrom added in v0.1.1

func (tx *Tx) CopyFrom(ctx context.Context, tableName pgx.Identifier, columnNames []string, rowSrc pgx.CopyFromSource) (int64, error)

func (*Tx) Exec added in v0.1.1

func (tx *Tx) Exec(ctx context.Context, sql string, args ...interface{}) (pgconn.CommandTag, error)

func (*Tx) LargeObjects added in v0.1.1

func (tx *Tx) LargeObjects() pgx.LargeObjects

func (*Tx) Prepare added in v0.1.1

func (tx *Tx) Prepare(ctx context.Context, name string, sql string) (*pgconn.StatementDescription, error)

func (*Tx) Query added in v0.1.1

func (tx *Tx) Query(ctx context.Context, sql string, args ...interface{}) (pgx.Rows, error)

func (*Tx) QueryRow added in v0.1.1

func (tx *Tx) QueryRow(ctx context.Context, sql string, args ...interface{}) pgx.Row

func (*Tx) Rollback added in v0.1.1

func (tx *Tx) Rollback(ctx context.Context) error

func (*Tx) SendBatch added in v0.1.1

func (tx *Tx) SendBatch(ctx context.Context, b *pgx.Batch) pgx.BatchResults

Jump to

Keyboard shortcuts

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