Documentation
¶
Index ¶
- type BunAdapter
- func (b *BunAdapter) BeginTx(ctx context.Context) (common.Database, error)
- func (b *BunAdapter) CommitTx(ctx context.Context) error
- func (b *BunAdapter) Exec(ctx context.Context, query string, args ...interface{}) (common.Result, error)
- func (b *BunAdapter) NewDelete() common.DeleteQuery
- func (b *BunAdapter) NewInsert() common.InsertQuery
- func (b *BunAdapter) NewSelect() common.SelectQuery
- func (b *BunAdapter) NewUpdate() common.UpdateQuery
- func (b *BunAdapter) Query(ctx context.Context, dest interface{}, query string, args ...interface{}) error
- func (b *BunAdapter) RollbackTx(ctx context.Context) error
- func (b *BunAdapter) RunInTransaction(ctx context.Context, fn func(common.Database) error) error
- type BunDeleteQuery
- type BunInsertQuery
- func (b *BunInsertQuery) Exec(ctx context.Context) (common.Result, error)
- func (b *BunInsertQuery) Model(model interface{}) common.InsertQuery
- func (b *BunInsertQuery) OnConflict(action string) common.InsertQuery
- func (b *BunInsertQuery) Returning(columns ...string) common.InsertQuery
- func (b *BunInsertQuery) Table(table string) common.InsertQuery
- func (b *BunInsertQuery) Value(column string, value interface{}) common.InsertQuery
- type BunResult
- type BunSelectQuery
- func (b *BunSelectQuery) Column(columns ...string) common.SelectQuery
- func (b *BunSelectQuery) Count(ctx context.Context) (int, error)
- func (b *BunSelectQuery) Exists(ctx context.Context) (bool, error)
- func (b *BunSelectQuery) Group(group string) common.SelectQuery
- func (b *BunSelectQuery) Having(having string, args ...interface{}) common.SelectQuery
- func (b *BunSelectQuery) Join(query string, args ...interface{}) common.SelectQuery
- func (b *BunSelectQuery) LeftJoin(query string, args ...interface{}) common.SelectQuery
- func (b *BunSelectQuery) Limit(n int) common.SelectQuery
- func (b *BunSelectQuery) Model(model interface{}) common.SelectQuery
- func (b *BunSelectQuery) Offset(n int) common.SelectQuery
- func (b *BunSelectQuery) Order(order string) common.SelectQuery
- func (b *BunSelectQuery) Preload(relation string, conditions ...interface{}) common.SelectQuery
- func (b *BunSelectQuery) Scan(ctx context.Context, dest interface{}) error
- func (b *BunSelectQuery) ScanModel(ctx context.Context) error
- func (b *BunSelectQuery) Table(table string) common.SelectQuery
- func (b *BunSelectQuery) Where(query string, args ...interface{}) common.SelectQuery
- func (b *BunSelectQuery) WhereOr(query string, args ...interface{}) common.SelectQuery
- type BunTxAdapter
- func (b *BunTxAdapter) BeginTx(ctx context.Context) (common.Database, error)
- func (b *BunTxAdapter) CommitTx(ctx context.Context) error
- func (b *BunTxAdapter) Exec(ctx context.Context, query string, args ...interface{}) (common.Result, error)
- func (b *BunTxAdapter) NewDelete() common.DeleteQuery
- func (b *BunTxAdapter) NewInsert() common.InsertQuery
- func (b *BunTxAdapter) NewSelect() common.SelectQuery
- func (b *BunTxAdapter) NewUpdate() common.UpdateQuery
- func (b *BunTxAdapter) Query(ctx context.Context, dest interface{}, query string, args ...interface{}) error
- func (b *BunTxAdapter) RollbackTx(ctx context.Context) error
- func (b *BunTxAdapter) RunInTransaction(ctx context.Context, fn func(common.Database) error) error
- type BunUpdateQuery
- func (b *BunUpdateQuery) Exec(ctx context.Context) (common.Result, error)
- func (b *BunUpdateQuery) Model(model interface{}) common.UpdateQuery
- func (b *BunUpdateQuery) Returning(columns ...string) common.UpdateQuery
- func (b *BunUpdateQuery) Set(column string, value interface{}) common.UpdateQuery
- func (b *BunUpdateQuery) SetMap(values map[string]interface{}) common.UpdateQuery
- func (b *BunUpdateQuery) Table(table string) common.UpdateQuery
- func (b *BunUpdateQuery) Where(query string, args ...interface{}) common.UpdateQuery
- type GormAdapter
- func (g *GormAdapter) BeginTx(ctx context.Context) (common.Database, error)
- func (g *GormAdapter) CommitTx(ctx context.Context) error
- func (g *GormAdapter) Exec(ctx context.Context, query string, args ...interface{}) (common.Result, error)
- func (g *GormAdapter) NewDelete() common.DeleteQuery
- func (g *GormAdapter) NewInsert() common.InsertQuery
- func (g *GormAdapter) NewSelect() common.SelectQuery
- func (g *GormAdapter) NewUpdate() common.UpdateQuery
- func (g *GormAdapter) Query(ctx context.Context, dest interface{}, query string, args ...interface{}) error
- func (g *GormAdapter) RollbackTx(ctx context.Context) error
- func (g *GormAdapter) RunInTransaction(ctx context.Context, fn func(common.Database) error) error
- type GormDeleteQuery
- type GormInsertQuery
- func (g *GormInsertQuery) Exec(ctx context.Context) (common.Result, error)
- func (g *GormInsertQuery) Model(model interface{}) common.InsertQuery
- func (g *GormInsertQuery) OnConflict(action string) common.InsertQuery
- func (g *GormInsertQuery) Returning(columns ...string) common.InsertQuery
- func (g *GormInsertQuery) Table(table string) common.InsertQuery
- func (g *GormInsertQuery) Value(column string, value interface{}) common.InsertQuery
- type GormResult
- type GormSelectQuery
- func (g *GormSelectQuery) Column(columns ...string) common.SelectQuery
- func (g *GormSelectQuery) Count(ctx context.Context) (int, error)
- func (g *GormSelectQuery) Exists(ctx context.Context) (bool, error)
- func (g *GormSelectQuery) Group(group string) common.SelectQuery
- func (g *GormSelectQuery) Having(having string, args ...interface{}) common.SelectQuery
- func (g *GormSelectQuery) Join(query string, args ...interface{}) common.SelectQuery
- func (g *GormSelectQuery) LeftJoin(query string, args ...interface{}) common.SelectQuery
- func (g *GormSelectQuery) Limit(n int) common.SelectQuery
- func (g *GormSelectQuery) Model(model interface{}) common.SelectQuery
- func (g *GormSelectQuery) Offset(n int) common.SelectQuery
- func (g *GormSelectQuery) Order(order string) common.SelectQuery
- func (g *GormSelectQuery) Preload(relation string, conditions ...interface{}) common.SelectQuery
- func (g *GormSelectQuery) Scan(ctx context.Context, dest interface{}) error
- func (g *GormSelectQuery) ScanModel(ctx context.Context) error
- func (g *GormSelectQuery) Table(table string) common.SelectQuery
- func (g *GormSelectQuery) Where(query string, args ...interface{}) common.SelectQuery
- func (g *GormSelectQuery) WhereOr(query string, args ...interface{}) common.SelectQuery
- type GormUpdateQuery
- func (g *GormUpdateQuery) Exec(ctx context.Context) (common.Result, error)
- func (g *GormUpdateQuery) Model(model interface{}) common.UpdateQuery
- func (g *GormUpdateQuery) Returning(columns ...string) common.UpdateQuery
- func (g *GormUpdateQuery) Set(column string, value interface{}) common.UpdateQuery
- func (g *GormUpdateQuery) SetMap(values map[string]interface{}) common.UpdateQuery
- func (g *GormUpdateQuery) Table(table string) common.UpdateQuery
- func (g *GormUpdateQuery) Where(query string, args ...interface{}) common.UpdateQuery
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BunAdapter ¶
type BunAdapter struct {
// contains filtered or unexported fields
}
BunAdapter adapts Bun to work with our Database interface This demonstrates how the abstraction works with different ORMs
func NewBunAdapter ¶
func NewBunAdapter(db *bun.DB) *BunAdapter
NewBunAdapter creates a new Bun adapter
func (*BunAdapter) NewDelete ¶
func (b *BunAdapter) NewDelete() common.DeleteQuery
func (*BunAdapter) NewInsert ¶
func (b *BunAdapter) NewInsert() common.InsertQuery
func (*BunAdapter) NewSelect ¶
func (b *BunAdapter) NewSelect() common.SelectQuery
func (*BunAdapter) NewUpdate ¶
func (b *BunAdapter) NewUpdate() common.UpdateQuery
func (*BunAdapter) Query ¶
func (b *BunAdapter) Query(ctx context.Context, dest interface{}, query string, args ...interface{}) error
func (*BunAdapter) RollbackTx ¶
func (b *BunAdapter) RollbackTx(ctx context.Context) error
func (*BunAdapter) RunInTransaction ¶
type BunDeleteQuery ¶
type BunDeleteQuery struct {
// contains filtered or unexported fields
}
BunDeleteQuery implements DeleteQuery for Bun
func (*BunDeleteQuery) Model ¶
func (b *BunDeleteQuery) Model(model interface{}) common.DeleteQuery
func (*BunDeleteQuery) Table ¶
func (b *BunDeleteQuery) Table(table string) common.DeleteQuery
func (*BunDeleteQuery) Where ¶
func (b *BunDeleteQuery) Where(query string, args ...interface{}) common.DeleteQuery
type BunInsertQuery ¶
type BunInsertQuery struct {
// contains filtered or unexported fields
}
BunInsertQuery implements InsertQuery for Bun
func (*BunInsertQuery) Model ¶
func (b *BunInsertQuery) Model(model interface{}) common.InsertQuery
func (*BunInsertQuery) OnConflict ¶
func (b *BunInsertQuery) OnConflict(action string) common.InsertQuery
func (*BunInsertQuery) Returning ¶
func (b *BunInsertQuery) Returning(columns ...string) common.InsertQuery
func (*BunInsertQuery) Table ¶
func (b *BunInsertQuery) Table(table string) common.InsertQuery
func (*BunInsertQuery) Value ¶
func (b *BunInsertQuery) Value(column string, value interface{}) common.InsertQuery
type BunResult ¶
type BunResult struct {
// contains filtered or unexported fields
}
BunResult implements Result for Bun
func (*BunResult) LastInsertId ¶
func (*BunResult) RowsAffected ¶
type BunSelectQuery ¶
type BunSelectQuery struct {
// contains filtered or unexported fields
}
BunSelectQuery implements SelectQuery for Bun
func (*BunSelectQuery) Column ¶
func (b *BunSelectQuery) Column(columns ...string) common.SelectQuery
func (*BunSelectQuery) Group ¶
func (b *BunSelectQuery) Group(group string) common.SelectQuery
func (*BunSelectQuery) Having ¶
func (b *BunSelectQuery) Having(having string, args ...interface{}) common.SelectQuery
func (*BunSelectQuery) Join ¶
func (b *BunSelectQuery) Join(query string, args ...interface{}) common.SelectQuery
func (*BunSelectQuery) LeftJoin ¶
func (b *BunSelectQuery) LeftJoin(query string, args ...interface{}) common.SelectQuery
func (*BunSelectQuery) Limit ¶
func (b *BunSelectQuery) Limit(n int) common.SelectQuery
func (*BunSelectQuery) Model ¶
func (b *BunSelectQuery) Model(model interface{}) common.SelectQuery
func (*BunSelectQuery) Offset ¶
func (b *BunSelectQuery) Offset(n int) common.SelectQuery
func (*BunSelectQuery) Order ¶
func (b *BunSelectQuery) Order(order string) common.SelectQuery
func (*BunSelectQuery) Preload ¶
func (b *BunSelectQuery) Preload(relation string, conditions ...interface{}) common.SelectQuery
func (*BunSelectQuery) Scan ¶
func (b *BunSelectQuery) Scan(ctx context.Context, dest interface{}) error
func (*BunSelectQuery) ScanModel ¶ added in v0.0.21
func (b *BunSelectQuery) ScanModel(ctx context.Context) error
func (*BunSelectQuery) Table ¶
func (b *BunSelectQuery) Table(table string) common.SelectQuery
func (*BunSelectQuery) Where ¶
func (b *BunSelectQuery) Where(query string, args ...interface{}) common.SelectQuery
func (*BunSelectQuery) WhereOr ¶
func (b *BunSelectQuery) WhereOr(query string, args ...interface{}) common.SelectQuery
type BunTxAdapter ¶
type BunTxAdapter struct {
// contains filtered or unexported fields
}
BunTxAdapter wraps a Bun transaction to implement the Database interface
func (*BunTxAdapter) NewDelete ¶
func (b *BunTxAdapter) NewDelete() common.DeleteQuery
func (*BunTxAdapter) NewInsert ¶
func (b *BunTxAdapter) NewInsert() common.InsertQuery
func (*BunTxAdapter) NewSelect ¶
func (b *BunTxAdapter) NewSelect() common.SelectQuery
func (*BunTxAdapter) NewUpdate ¶
func (b *BunTxAdapter) NewUpdate() common.UpdateQuery
func (*BunTxAdapter) Query ¶
func (b *BunTxAdapter) Query(ctx context.Context, dest interface{}, query string, args ...interface{}) error
func (*BunTxAdapter) RollbackTx ¶
func (b *BunTxAdapter) RollbackTx(ctx context.Context) error
func (*BunTxAdapter) RunInTransaction ¶
type BunUpdateQuery ¶
type BunUpdateQuery struct {
// contains filtered or unexported fields
}
BunUpdateQuery implements UpdateQuery for Bun
func (*BunUpdateQuery) Model ¶
func (b *BunUpdateQuery) Model(model interface{}) common.UpdateQuery
func (*BunUpdateQuery) Returning ¶
func (b *BunUpdateQuery) Returning(columns ...string) common.UpdateQuery
func (*BunUpdateQuery) Set ¶
func (b *BunUpdateQuery) Set(column string, value interface{}) common.UpdateQuery
func (*BunUpdateQuery) SetMap ¶
func (b *BunUpdateQuery) SetMap(values map[string]interface{}) common.UpdateQuery
func (*BunUpdateQuery) Table ¶
func (b *BunUpdateQuery) Table(table string) common.UpdateQuery
func (*BunUpdateQuery) Where ¶
func (b *BunUpdateQuery) Where(query string, args ...interface{}) common.UpdateQuery
type GormAdapter ¶
type GormAdapter struct {
// contains filtered or unexported fields
}
GormAdapter adapts GORM to work with our Database interface
func NewGormAdapter ¶
func NewGormAdapter(db *gorm.DB) *GormAdapter
NewGormAdapter creates a new GORM adapter
func (*GormAdapter) NewDelete ¶
func (g *GormAdapter) NewDelete() common.DeleteQuery
func (*GormAdapter) NewInsert ¶
func (g *GormAdapter) NewInsert() common.InsertQuery
func (*GormAdapter) NewSelect ¶
func (g *GormAdapter) NewSelect() common.SelectQuery
func (*GormAdapter) NewUpdate ¶
func (g *GormAdapter) NewUpdate() common.UpdateQuery
func (*GormAdapter) Query ¶
func (g *GormAdapter) Query(ctx context.Context, dest interface{}, query string, args ...interface{}) error
func (*GormAdapter) RollbackTx ¶
func (g *GormAdapter) RollbackTx(ctx context.Context) error
func (*GormAdapter) RunInTransaction ¶
type GormDeleteQuery ¶
type GormDeleteQuery struct {
// contains filtered or unexported fields
}
GormDeleteQuery implements DeleteQuery for GORM
func (*GormDeleteQuery) Model ¶
func (g *GormDeleteQuery) Model(model interface{}) common.DeleteQuery
func (*GormDeleteQuery) Table ¶
func (g *GormDeleteQuery) Table(table string) common.DeleteQuery
func (*GormDeleteQuery) Where ¶
func (g *GormDeleteQuery) Where(query string, args ...interface{}) common.DeleteQuery
type GormInsertQuery ¶
type GormInsertQuery struct {
// contains filtered or unexported fields
}
GormInsertQuery implements InsertQuery for GORM
func (*GormInsertQuery) Model ¶
func (g *GormInsertQuery) Model(model interface{}) common.InsertQuery
func (*GormInsertQuery) OnConflict ¶
func (g *GormInsertQuery) OnConflict(action string) common.InsertQuery
func (*GormInsertQuery) Returning ¶
func (g *GormInsertQuery) Returning(columns ...string) common.InsertQuery
func (*GormInsertQuery) Table ¶
func (g *GormInsertQuery) Table(table string) common.InsertQuery
func (*GormInsertQuery) Value ¶
func (g *GormInsertQuery) Value(column string, value interface{}) common.InsertQuery
type GormResult ¶
type GormResult struct {
// contains filtered or unexported fields
}
GormResult implements Result for GORM
func (*GormResult) LastInsertId ¶
func (g *GormResult) LastInsertId() (int64, error)
func (*GormResult) RowsAffected ¶
func (g *GormResult) RowsAffected() int64
type GormSelectQuery ¶
type GormSelectQuery struct {
// contains filtered or unexported fields
}
GormSelectQuery implements SelectQuery for GORM
func (*GormSelectQuery) Column ¶
func (g *GormSelectQuery) Column(columns ...string) common.SelectQuery
func (*GormSelectQuery) Exists ¶
func (g *GormSelectQuery) Exists(ctx context.Context) (bool, error)
func (*GormSelectQuery) Group ¶
func (g *GormSelectQuery) Group(group string) common.SelectQuery
func (*GormSelectQuery) Having ¶
func (g *GormSelectQuery) Having(having string, args ...interface{}) common.SelectQuery
func (*GormSelectQuery) Join ¶
func (g *GormSelectQuery) Join(query string, args ...interface{}) common.SelectQuery
func (*GormSelectQuery) LeftJoin ¶
func (g *GormSelectQuery) LeftJoin(query string, args ...interface{}) common.SelectQuery
func (*GormSelectQuery) Limit ¶
func (g *GormSelectQuery) Limit(n int) common.SelectQuery
func (*GormSelectQuery) Model ¶
func (g *GormSelectQuery) Model(model interface{}) common.SelectQuery
func (*GormSelectQuery) Offset ¶
func (g *GormSelectQuery) Offset(n int) common.SelectQuery
func (*GormSelectQuery) Order ¶
func (g *GormSelectQuery) Order(order string) common.SelectQuery
func (*GormSelectQuery) Preload ¶
func (g *GormSelectQuery) Preload(relation string, conditions ...interface{}) common.SelectQuery
func (*GormSelectQuery) Scan ¶
func (g *GormSelectQuery) Scan(ctx context.Context, dest interface{}) error
func (*GormSelectQuery) ScanModel ¶ added in v0.0.21
func (g *GormSelectQuery) ScanModel(ctx context.Context) error
func (*GormSelectQuery) Table ¶
func (g *GormSelectQuery) Table(table string) common.SelectQuery
func (*GormSelectQuery) Where ¶
func (g *GormSelectQuery) Where(query string, args ...interface{}) common.SelectQuery
func (*GormSelectQuery) WhereOr ¶
func (g *GormSelectQuery) WhereOr(query string, args ...interface{}) common.SelectQuery
type GormUpdateQuery ¶
type GormUpdateQuery struct {
// contains filtered or unexported fields
}
GormUpdateQuery implements UpdateQuery for GORM
func (*GormUpdateQuery) Model ¶
func (g *GormUpdateQuery) Model(model interface{}) common.UpdateQuery
func (*GormUpdateQuery) Returning ¶
func (g *GormUpdateQuery) Returning(columns ...string) common.UpdateQuery
func (*GormUpdateQuery) Set ¶
func (g *GormUpdateQuery) Set(column string, value interface{}) common.UpdateQuery
func (*GormUpdateQuery) SetMap ¶
func (g *GormUpdateQuery) SetMap(values map[string]interface{}) common.UpdateQuery
func (*GormUpdateQuery) Table ¶
func (g *GormUpdateQuery) Table(table string) common.UpdateQuery
func (*GormUpdateQuery) Where ¶
func (g *GormUpdateQuery) Where(query string, args ...interface{}) common.UpdateQuery