bundb

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2021 License: AGPL-3.0 Imports: 39 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBunDBService

func NewBunDBService(ctx context.Context, c *config.Config) (db.DB, error)

NewBunDBService returns a bunDB derived from the provided config, which implements the go-fed DB interface. Under the hood, it uses https://github.com/uptrace/bun to create and maintain a database connection.

Types

type DBConn

type DBConn struct {
	*bun.DB // DB is the underlying bun.DB connection
	// contains filtered or unexported fields
}

DBConn wrapps a bun.DB conn to provide SQL-type specific additional functionality

func WrapDBConn

func WrapDBConn(dbConn *bun.DB) *DBConn

WrapDBConn @TODO

func (*DBConn) Exists

func (conn *DBConn) Exists(ctx context.Context, query *bun.SelectQuery) (bool, db.Error)

Exists checks the results of a SelectQuery for the existence of the data in question, masking ErrNoEntries errors

func (*DBConn) NotExists

func (conn *DBConn) NotExists(ctx context.Context, query *bun.SelectQuery) (bool, db.Error)

NotExists is the functional opposite of conn.Exists()

func (*DBConn) ProcessError

func (conn *DBConn) ProcessError(err error) db.Error

ProcessError processes an error to replace any known values with our own db.Error types, making it easier to catch specific situations (e.g. no rows, already exists, etc)

func (*DBConn) RunInTx

func (conn *DBConn) RunInTx(ctx context.Context, fn func(bun.Tx) error) db.Error

RunInTx wraps execution of the supplied transaction function.

Directories

Path Synopsis
20211113114307_init
Package gtsmodel contains types used *internally* by GoToSocial and added/removed/selected from the database.
Package gtsmodel contains types used *internally* by GoToSocial and added/removed/selected from the database.

Jump to

Keyboard shortcuts

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