Documentation ¶
Index ¶
- type DB
- func (db *DB) Begin() (transaction.Transaction, error)
- func (db *DB) BeginTx(_ context.Context, _ *transaction.TxOptions) (transaction.Transaction, error)
- func (db *DB) Close()
- func (db *DB) Connect(format, conn string, maxOpenConn int) error
- func (db *DB) DropTable(s *schema.Schema) error
- func (db *DB) Options() options.Options
- func (db *DB) RegisterTable(s *schema.Schema, cascade, migrate bool) error
- type Transaction
- func (tx *Transaction) Close() error
- func (tx *Transaction) Closed() bool
- func (tx *Transaction) Commit() error
- func (tx *Transaction) CountContext(_ context.Context, s *schema.Schema, filter transaction.Filter) (uint64, error)
- func (tx *Transaction) Create(resource *schema.Resource) error
- func (tx *Transaction) CreateContext(_ context.Context, resource *schema.Resource) error
- func (tx *Transaction) Delete(s *schema.Schema, resourceID interface{}) error
- func (tx *Transaction) DeleteContext(_ context.Context, s *schema.Schema, resourceID interface{}) error
- func (tx *Transaction) Exec(sql string, args ...interface{}) error
- func (tx *Transaction) ExecContext(_ context.Context, sql string, args ...interface{}) error
- func (tx *Transaction) Fetch(s *schema.Schema, filter transaction.Filter, options *transaction.ViewOptions) (*schema.Resource, error)
- func (tx *Transaction) FetchContext(_ context.Context, s *schema.Schema, filter transaction.Filter, ...) (*schema.Resource, error)
- func (tx *Transaction) GetIsolationLevel() transaction.Type
- func (tx *Transaction) List(s *schema.Schema, filter transaction.Filter, options *transaction.ViewOptions, ...) (list []*schema.Resource, total uint64, err error)
- func (tx *Transaction) ListContext(_ context.Context, s *schema.Schema, filter transaction.Filter, ...) (list []*schema.Resource, total uint64, err error)
- func (tx *Transaction) LockFetch(s *schema.Schema, filter transaction.Filter, policy schema.LockPolicy, ...) (*schema.Resource, error)
- func (tx *Transaction) LockFetchContext(_ context.Context, s *schema.Schema, filter transaction.Filter, ...) (*schema.Resource, error)
- func (tx *Transaction) LockList(s *schema.Schema, filter transaction.Filter, options *transaction.ViewOptions, ...) (list []*schema.Resource, total uint64, err error)
- func (tx *Transaction) LockListContext(_ context.Context, s *schema.Schema, filter transaction.Filter, ...) (list []*schema.Resource, total uint64, err error)
- func (tx *Transaction) Query(s *schema.Schema, query string, arguments []interface{}) (list []*schema.Resource, err error)
- func (tx *Transaction) QueryContext(_ context.Context, s *schema.Schema, query string, arguments []interface{}) (list []*schema.Resource, err error)
- func (tx *Transaction) RawTransaction() *sqlx.Tx
- func (tx *Transaction) SetIsolationLevel(level transaction.Type) error
- func (tx *Transaction) StateFetch(s *schema.Schema, filter transaction.Filter) (state transaction.ResourceState, err error)
- func (tx *Transaction) StateFetchContext(_ context.Context, s *schema.Schema, filter transaction.Filter) (state transaction.ResourceState, err error)
- func (tx *Transaction) StateUpdate(resource *schema.Resource, _ *transaction.ResourceState) error
- func (tx *Transaction) StateUpdateContext(_ context.Context, resource *schema.Resource, state *transaction.ResourceState) error
- func (tx *Transaction) Update(resource *schema.Resource) error
- func (tx *Transaction) UpdateContext(_ context.Context, resource *schema.Resource) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB is yaml implementation of DB This db backend is intended for development and test purpose only
func (*DB) Begin ¶
func (db *DB) Begin() (transaction.Transaction, error)
Begin connection starts new transaction
func (*DB) BeginTx ¶
func (db *DB) BeginTx(_ context.Context, _ *transaction.TxOptions) (transaction.Transaction, error)
BeginTx connection starts new transaction with given transaction options
type Transaction ¶
type Transaction struct {
// contains filtered or unexported fields
}
Transaction is yaml implementation of DB This db backend is intended for development and test purpose only
func (*Transaction) Commit ¶
func (tx *Transaction) Commit() error
Commit commits changes to db Unsupported in this db
func (*Transaction) CountContext ¶
func (tx *Transaction) CountContext(_ context.Context, s *schema.Schema, filter transaction.Filter) (uint64, error)
func (*Transaction) Create ¶
func (tx *Transaction) Create(resource *schema.Resource) error
Create create resource in the db
func (*Transaction) CreateContext ¶
func (*Transaction) Delete ¶
func (tx *Transaction) Delete(s *schema.Schema, resourceID interface{}) error
Delete delete resource from db
func (*Transaction) DeleteContext ¶
func (*Transaction) Exec ¶
func (tx *Transaction) Exec(sql string, args ...interface{}) error
Exec executes sql in transaction
func (*Transaction) ExecContext ¶
func (tx *Transaction) ExecContext(_ context.Context, sql string, args ...interface{}) error
func (*Transaction) Fetch ¶
func (tx *Transaction) Fetch(s *schema.Schema, filter transaction.Filter, options *transaction.ViewOptions) (*schema.Resource, error)
Fetch resources by ID in the db
func (*Transaction) FetchContext ¶
func (tx *Transaction) FetchContext(_ context.Context, s *schema.Schema, filter transaction.Filter, options *transaction.ViewOptions) (*schema.Resource, error)
func (*Transaction) GetIsolationLevel ¶
func (tx *Transaction) GetIsolationLevel() transaction.Type
GetIsolationLevel is unsupported in this db
func (*Transaction) List ¶
func (tx *Transaction) List(s *schema.Schema, filter transaction.Filter, options *transaction.ViewOptions, pg *pagination.Paginator) (list []*schema.Resource, total uint64, err error)
List resources in the db
func (*Transaction) ListContext ¶
func (tx *Transaction) ListContext(_ context.Context, s *schema.Schema, filter transaction.Filter, options *transaction.ViewOptions, pg *pagination.Paginator) (list []*schema.Resource, total uint64, err error)
func (*Transaction) LockFetch ¶
func (tx *Transaction) LockFetch(s *schema.Schema, filter transaction.Filter, policy schema.LockPolicy, options *transaction.ViewOptions) (*schema.Resource, error)
LockFetch fetches & locks a resource. Not supported in file db
func (*Transaction) LockFetchContext ¶
func (tx *Transaction) LockFetchContext(_ context.Context, s *schema.Schema, filter transaction.Filter, policy schema.LockPolicy, options *transaction.ViewOptions) (*schema.Resource, error)
func (*Transaction) LockList ¶
func (tx *Transaction) LockList(s *schema.Schema, filter transaction.Filter, options *transaction.ViewOptions, pg *pagination.Paginator, policy schema.LockPolicy) (list []*schema.Resource, total uint64, err error)
LockList locks resources in the db. Not supported in file db
func (*Transaction) LockListContext ¶
func (tx *Transaction) LockListContext(_ context.Context, s *schema.Schema, filter transaction.Filter, options *transaction.ViewOptions, pg *pagination.Paginator, policy schema.LockPolicy) (list []*schema.Resource, total uint64, err error)
func (*Transaction) Query ¶
func (tx *Transaction) Query(s *schema.Schema, query string, arguments []interface{}) (list []*schema.Resource, err error)
Query with raw string
func (*Transaction) QueryContext ¶
func (*Transaction) RawTransaction ¶
func (tx *Transaction) RawTransaction() *sqlx.Tx
RawTransaction returns raw transaction
func (*Transaction) SetIsolationLevel ¶
func (tx *Transaction) SetIsolationLevel(level transaction.Type) error
SetIsolationLevel specify transaction isolation level
func (*Transaction) StateFetch ¶
func (tx *Transaction) StateFetch(s *schema.Schema, filter transaction.Filter) (state transaction.ResourceState, err error)
StateFetch is not supported in file databases
func (*Transaction) StateFetchContext ¶
func (tx *Transaction) StateFetchContext(_ context.Context, s *schema.Schema, filter transaction.Filter) (state transaction.ResourceState, err error)
func (*Transaction) StateUpdate ¶
func (tx *Transaction) StateUpdate(resource *schema.Resource, _ *transaction.ResourceState) error
StateUpdate update resource state
func (*Transaction) StateUpdateContext ¶
func (tx *Transaction) StateUpdateContext(_ context.Context, resource *schema.Resource, state *transaction.ResourceState) error
func (*Transaction) Update ¶
func (tx *Transaction) Update(resource *schema.Resource) error
Update update resource in the db