Documentation ¶
Index ¶
- func NewBunDBService(ctx context.Context, c *config.Config) (db.DB, error)
- type DBConn
- func (conn *DBConn) Exists(ctx context.Context, query *bun.SelectQuery) (bool, db.Error)
- func (conn *DBConn) NotExists(ctx context.Context, query *bun.SelectQuery) (bool, db.Error)
- func (conn *DBConn) ProcessError(err error) db.Error
- func (conn *DBConn) RunInTx(ctx context.Context, fn func(bun.Tx) error) db.Error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewBunDBService ¶
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 (*DBConn) Exists ¶
Exists checks the results of a SelectQuery for the existence of the data in question, masking ErrNoEntries errors
func (*DBConn) ProcessError ¶
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)
Source Files ¶
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. |
Click to show internal directories.
Click to hide internal directories.