Documentation ¶
Index ¶
- func NewBunDBService(ctx context.Context, state *state.State) (db.DB, error)
- type DB
- func (db *DB) AddQueryHook(hook bun.QueryHook)
- func (db *DB) BeginTx(ctx context.Context, opts *sql.TxOptions) (tx Tx, err error)
- func (db *DB) Close() error
- func (db *DB) Dialect() schema.Dialect
- func (db *DB) ExecContext(ctx context.Context, query string, args ...any) (result sql.Result, err error)
- func (db *DB) Exists(ctx context.Context, query *bun.SelectQuery) (bool, error)
- func (db *DB) NewAddColumn() *bun.AddColumnQuery
- func (db *DB) NewCreateIndex() *bun.CreateIndexQuery
- func (db *DB) NewCreateTable() *bun.CreateTableQuery
- func (db *DB) NewDelete() *bun.DeleteQuery
- func (db *DB) NewDropColumn() *bun.DropColumnQuery
- func (db *DB) NewDropIndex() *bun.DropIndexQuery
- func (db *DB) NewDropTable() *bun.DropTableQuery
- func (db *DB) NewInsert() *bun.InsertQuery
- func (db *DB) NewMerge() *bun.MergeQuery
- func (db *DB) NewRaw(query string, args ...interface{}) *bun.RawQuery
- func (db *DB) NewSelect() *bun.SelectQuery
- func (db *DB) NewTruncateTable() *bun.TruncateTableQuery
- func (db *DB) NewUpdate() *bun.UpdateQuery
- func (db *DB) NewValues(model interface{}) *bun.ValuesQuery
- func (db *DB) NotExists(ctx context.Context, query *bun.SelectQuery) (bool, error)
- func (db *DB) PingContext(ctx context.Context) error
- func (db *DB) QueryContext(ctx context.Context, query string, args ...any) (rows *sql.Rows, err error)
- func (db *DB) QueryRowContext(ctx context.Context, query string, args ...any) (row *sql.Row)
- func (db *DB) RegisterModel(models ...any)
- func (db *DB) RunInTx(ctx context.Context, fn func(Tx) error) error
- type DBService
- type Tx
- func (tx Tx) Commit() (err error)
- func (tx Tx) Dialect() schema.Dialect
- func (tx Tx) ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
- func (tx Tx) NewAddColumn() *bun.AddColumnQuery
- func (tx Tx) NewCreateIndex() *bun.CreateIndexQuery
- func (tx Tx) NewCreateTable() *bun.CreateTableQuery
- func (tx Tx) NewDelete() *bun.DeleteQuery
- func (tx Tx) NewDropColumn() *bun.DropColumnQuery
- func (tx Tx) NewDropIndex() *bun.DropIndexQuery
- func (tx Tx) NewDropTable() *bun.DropTableQuery
- func (tx Tx) NewInsert() *bun.InsertQuery
- func (tx Tx) NewMerge() *bun.MergeQuery
- func (tx Tx) NewRaw(query string, args ...interface{}) *bun.RawQuery
- func (tx Tx) NewSelect() *bun.SelectQuery
- func (tx Tx) NewTruncateTable() *bun.TruncateTableQuery
- func (tx Tx) NewUpdate() *bun.UpdateQuery
- func (tx Tx) NewValues(model interface{}) *bun.ValuesQuery
- func (tx Tx) QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)
- func (tx Tx) QueryRowContext(ctx context.Context, query string, args ...interface{}) *sql.Row
- func (tx Tx) Rollback() (err 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 DB ¶ added in v0.11.1
type DB struct {
// contains filtered or unexported fields
}
DB wraps a bun database instance to provide common per-dialect SQL error conversions to common types, and retries on returned busy (SQLite only).
func (*DB) AddQueryHook ¶ added in v0.11.1
AddQueryHook is a direct call-through to bun.DB.AddQueryHook().
func (*DB) BeginTx ¶ added in v0.11.1
BeginTx wraps bun.DB.BeginTx() with retry-busy timeout and our own error processing.
func (*DB) ExecContext ¶ added in v0.11.1
func (db *DB) ExecContext(ctx context.Context, query string, args ...any) (result sql.Result, err error)
ExecContext wraps bun.DB.ExecContext() with retry-busy timeout and our own error processing.
func (*DB) Exists ¶ added in v0.11.1
Exists checks the results of a SelectQuery for the existence of the data in question, masking ErrNoEntries errors.
func (*DB) NewAddColumn ¶ added in v0.11.1
func (db *DB) NewAddColumn() *bun.AddColumnQuery
func (*DB) NewCreateIndex ¶ added in v0.11.1
func (db *DB) NewCreateIndex() *bun.CreateIndexQuery
func (*DB) NewCreateTable ¶ added in v0.11.1
func (db *DB) NewCreateTable() *bun.CreateTableQuery
func (*DB) NewDelete ¶ added in v0.11.1
func (db *DB) NewDelete() *bun.DeleteQuery
func (*DB) NewDropColumn ¶ added in v0.11.1
func (db *DB) NewDropColumn() *bun.DropColumnQuery
func (*DB) NewDropIndex ¶ added in v0.11.1
func (db *DB) NewDropIndex() *bun.DropIndexQuery
func (*DB) NewDropTable ¶ added in v0.11.1
func (db *DB) NewDropTable() *bun.DropTableQuery
func (*DB) NewInsert ¶ added in v0.11.1
func (db *DB) NewInsert() *bun.InsertQuery
func (*DB) NewMerge ¶ added in v0.11.1
func (db *DB) NewMerge() *bun.MergeQuery
func (*DB) NewSelect ¶ added in v0.11.1
func (db *DB) NewSelect() *bun.SelectQuery
func (*DB) NewTruncateTable ¶ added in v0.11.1
func (db *DB) NewTruncateTable() *bun.TruncateTableQuery
func (*DB) NewUpdate ¶ added in v0.11.1
func (db *DB) NewUpdate() *bun.UpdateQuery
func (*DB) NewValues ¶ added in v0.11.1
func (db *DB) NewValues(model interface{}) *bun.ValuesQuery
func (*DB) NotExists ¶ added in v0.11.1
NotExists checks the results of a SelectQuery for the non-existence of the data in question, masking ErrNoEntries errors.
func (*DB) PingContext ¶ added in v0.11.1
PingContext is a direct call-through to bun.DB.PingContext().
func (*DB) QueryContext ¶ added in v0.11.1
func (db *DB) QueryContext(ctx context.Context, query string, args ...any) (rows *sql.Rows, err error)
QueryContext wraps bun.DB.ExecContext() with retry-busy timeout and our own error processing.
func (*DB) QueryRowContext ¶ added in v0.11.1
QueryRowContext wraps bun.DB.ExecContext() with retry-busy timeout and our own error processing.
func (*DB) RegisterModel ¶ added in v0.11.1
RegisterModels is a direct call-through to bun.DB.RegisterModels().
type DBService ¶ added in v0.5.0
type DBService struct { db.Account db.Admin db.Application db.Basic db.Domain db.Emoji db.Instance db.List db.Marker db.Media db.Mention db.Notification db.Relationship db.Report db.Rule db.Search db.Session db.Status db.StatusBookmark db.StatusFave db.Tag db.Timeline db.User db.Tombstone // contains filtered or unexported fields }
DBService satisfies the DB interface
type Tx ¶ added in v0.12.0
type Tx struct {
// contains filtered or unexported fields
}
Tx wraps a bun transaction instance to provide common per-dialect SQL error conversions to common types, and retries on busy commit/rollback (SQLite only).
func (Tx) Commit ¶ added in v0.12.0
Commit wraps bun.Tx.Commit() with retry-busy timeout and our own error processing.
func (Tx) ExecContext ¶ added in v0.12.0
func (tx Tx) ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
ExecContext wraps bun.Tx.ExecContext() with our own error processing, WITHOUT retry-busy timeouts (as will be mid-transaction).
func (Tx) NewAddColumn ¶ added in v0.12.0
func (tx Tx) NewAddColumn() *bun.AddColumnQuery
func (Tx) NewCreateIndex ¶ added in v0.12.0
func (tx Tx) NewCreateIndex() *bun.CreateIndexQuery
func (Tx) NewCreateTable ¶ added in v0.12.0
func (tx Tx) NewCreateTable() *bun.CreateTableQuery
func (Tx) NewDelete ¶ added in v0.12.0
func (tx Tx) NewDelete() *bun.DeleteQuery
func (Tx) NewDropColumn ¶ added in v0.12.0
func (tx Tx) NewDropColumn() *bun.DropColumnQuery
func (Tx) NewDropIndex ¶ added in v0.12.0
func (tx Tx) NewDropIndex() *bun.DropIndexQuery
func (Tx) NewDropTable ¶ added in v0.12.0
func (tx Tx) NewDropTable() *bun.DropTableQuery
func (Tx) NewInsert ¶ added in v0.12.0
func (tx Tx) NewInsert() *bun.InsertQuery
func (Tx) NewMerge ¶ added in v0.12.0
func (tx Tx) NewMerge() *bun.MergeQuery
func (Tx) NewSelect ¶ added in v0.12.0
func (tx Tx) NewSelect() *bun.SelectQuery
func (Tx) NewTruncateTable ¶ added in v0.12.0
func (tx Tx) NewTruncateTable() *bun.TruncateTableQuery
func (Tx) NewUpdate ¶ added in v0.12.0
func (tx Tx) NewUpdate() *bun.UpdateQuery
func (Tx) NewValues ¶ added in v0.12.0
func (tx Tx) NewValues(model interface{}) *bun.ValuesQuery
func (Tx) QueryContext ¶ added in v0.12.0
func (tx Tx) QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)
QueryContext wraps bun.Tx.QueryContext() with our own error processing, WITHOUT retry-busy timeouts (as will be mid-transaction).
func (Tx) QueryRowContext ¶ added in v0.12.0
QueryRowContext wraps bun.Tx.QueryRowContext() with our own error processing, WITHOUT retry-busy timeouts (as will be mid-transaction).
Source Files ¶
- account.go
- admin.go
- application.go
- basic.go
- bundb.go
- db.go
- domain.go
- emoji.go
- errors.go
- hook.go
- instance.go
- list.go
- marker.go
- media.go
- mention.go
- notification.go
- relationship.go
- relationship_block.go
- relationship_follow.go
- relationship_follow_req.go
- relationship_note.go
- report.go
- rule.go
- search.go
- session.go
- status.go
- statusbookmark.go
- statusfave.go
- tag.go
- timeline.go
- tombstone.go
- user.go
- util.go
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. |
20220214175650_media_cleanup
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. |
20220315160814_admin_account_actions
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. |