db

package
v0.0.0-...-7ed3587 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CommitPrepared

func CommitPrepared(ctx context.Context, dbConn sqlx.ExecerContext, txID string) error

func Connect

func Connect(ctx context.Context, conf *config.DB) (*sqlx.DB, error)

Connect creates new db connection.

func CreateUser

func CreateUser(ctx context.Context, dbConn NamedExecutorContext, user *User) error

func Disconnect

func Disconnect(ctx context.Context, dbConn *sqlx.DB) error

Disconnect drops db connection.

func PrepareTransaction

func PrepareTransaction(ctx context.Context, dbConn sqlx.ExecerContext, txID string) error

func RollbackPrepared

func RollbackPrepared(ctx context.Context, dbConn sqlx.ExecerContext, txID string) error

Types

type NamedExecutorContext

type NamedExecutorContext interface {
	NamedExecContext(ctx context.Context, query string, arg interface{}) (sql.Result, error)
}

type User

type User struct {
	CreatedAt time.Time `db:"created_at"`
	Name      string    `db:"name"`
	ID        uuid.UUID `db:"id"`
}

Jump to

Keyboard shortcuts

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