Documentation
¶
Index ¶
- Variables
- type ConnectionOptions
- type Handle
- type HookHandle
- type InsertBuilder
- type MockHandle
- type PQListener
- type PageKey
- type Pool
- type SQLBuilder
- type SQLBuilderApp
- type SQLExecutor
- type Scanner
- type SelectBuilder
- func (b SelectBuilder) From(from string, alias ...string) SelectBuilder
- func (b SelectBuilder) Join(from string, alias string, pred string, args ...interface{}) SelectBuilder
- func (b SelectBuilder) Limit(limit uint64) SelectBuilder
- func (b SelectBuilder) OrderBy(orderBy ...string) SelectBuilder
- func (b SelectBuilder) ToSql() (string, []interface{}, error)
- func (b SelectBuilder) Where(pred interface{}, args ...interface{}) SelectBuilder
- type TransactionHook
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInvalidCursor = InvalidCursor.New("invalid pagination cursor")
View Source
var ErrWriteConflict = apierrors.NewDataRace("concurrent write conflict occurred")
View Source
var InvalidCursor = apierrors.Invalid.WithReason("InvalidCursor")
View Source
var InvalidQuery = apierrors.BadRequest.WithReason("InvalidQuery")
Functions ¶
This section is empty.
Types ¶
type ConnectionOptions ¶
type Handle ¶
type Handle interface { // WithTx runs do within a transaction. // If there is no error, the transaction is committed. WithTx(do func() error) (err error) // ReadOnly runs do within a transaction. // The transaction is always rolled back. ReadOnly(do func() error) (err error) // contains filtered or unexported methods }
Handle allows a function to be run within a transaction.
type HookHandle ¶
type HookHandle struct { Context context.Context Pool *Pool ConnectionOptions ConnectionOptions Logger *log.Logger // contains filtered or unexported fields }
func NewHookHandle ¶
func NewHookHandle(ctx context.Context, pool *Pool, opts ConnectionOptions, lf *log.Factory) *HookHandle
func (*HookHandle) ReadOnly ¶
func (h *HookHandle) ReadOnly(do func() error) (err error)
ReadOnly runs do in a transaction and rolls back always.
func (*HookHandle) UseHook ¶
func (h *HookHandle) UseHook(hook TransactionHook)
func (*HookHandle) WithTx ¶
func (h *HookHandle) WithTx(do func() error) (err error)
WithTx commits if do finishes without error and rolls back otherwise.
type InsertBuilder ¶
type InsertBuilder struct {
// contains filtered or unexported fields
}
func (InsertBuilder) Columns ¶
func (b InsertBuilder) Columns(columns ...string) InsertBuilder
func (InsertBuilder) Suffix ¶
func (b InsertBuilder) Suffix(sql string, args ...interface{}) InsertBuilder
func (InsertBuilder) ToSql ¶
func (b InsertBuilder) ToSql() (string, []interface{}, error)
nolint: golint
func (InsertBuilder) Values ¶
func (b InsertBuilder) Values(values ...interface{}) InsertBuilder
type MockHandle ¶
type MockHandle struct{}
func (*MockHandle) ReadOnly ¶
func (h *MockHandle) ReadOnly(do func() error) (err error)
func (*MockHandle) WithTx ¶
func (h *MockHandle) WithTx(do func() error) (err error)
type PQListener ¶
type PageKey ¶
type PageKey struct {
Offset uint64
}
func NewFromPageCursor ¶
func NewFromPageCursor(k model.PageCursor) (*PageKey, error)
func (*PageKey) ToPageCursor ¶
func (k *PageKey) ToPageCursor() (model.PageCursor, error)
type SQLBuilder ¶
type SQLBuilder struct { sq.StatementBuilderType // contains filtered or unexported fields }
func NewSQLBuilder ¶
func NewSQLBuilder(schema string) SQLBuilder
type SQLBuilderApp ¶
type SQLBuilderApp struct {
// contains filtered or unexported fields
}
func NewSQLBuilderApp ¶
func NewSQLBuilderApp(schema string, appID string) SQLBuilderApp
func (SQLBuilderApp) Delete ¶
func (b SQLBuilderApp) Delete(from string) sq.DeleteBuilder
func (SQLBuilderApp) Insert ¶
func (b SQLBuilderApp) Insert(into string) InsertBuilder
func (SQLBuilderApp) Select ¶
func (b SQLBuilderApp) Select(columns ...string) SelectBuilder
func (SQLBuilderApp) Update ¶
func (b SQLBuilderApp) Update(table string) sq.UpdateBuilder
type Scanner ¶
type Scanner interface {
Scan(dest ...interface{}) error
}
Scanner is sqlx.Row or sqlx.Rows.
type SelectBuilder ¶
type SelectBuilder struct {
// contains filtered or unexported fields
}
func ApplyPageArgs ¶
func ApplyPageArgs(builder SelectBuilder, pageArgs graphqlutil.PageArgs) (out SelectBuilder, offset uint64, err error)
func (SelectBuilder) From ¶
func (b SelectBuilder) From(from string, alias ...string) SelectBuilder
func (SelectBuilder) Join ¶
func (b SelectBuilder) Join(from string, alias string, pred string, args ...interface{}) SelectBuilder
func (SelectBuilder) Limit ¶
func (b SelectBuilder) Limit(limit uint64) SelectBuilder
func (SelectBuilder) OrderBy ¶
func (b SelectBuilder) OrderBy(orderBy ...string) SelectBuilder
func (SelectBuilder) ToSql ¶
func (b SelectBuilder) ToSql() (string, []interface{}, error)
nolint: golint
func (SelectBuilder) Where ¶
func (b SelectBuilder) Where(pred interface{}, args ...interface{}) SelectBuilder
type TransactionHook ¶
type TransactionHook interface { WillCommitTx() error DidCommitTx() }
Source Files
¶
Click to show internal directories.
Click to hide internal directories.