Documentation ¶
Index ¶
- type Driver
- func (d *Driver) BeginTransaction(c *libdata.Cluster, tenant *libdata.Tenant, useCache bool) (*libdata.Transaction, error)
- func (d *Driver) CommitTransaction(tx *libdata.Transaction) error
- func (d *Driver) CreateTenant(cluster *libdata.Cluster, tenant *libdata.Tenant) error
- func (d *Driver) Delete(ctx context.Context, tx *libdata.Transaction, model *libdata.ModelDefinition, ...) error
- func (d *Driver) GenerateScanFunc(model *libdata.ModelDefinition) string
- func (d *Driver) GetTenant(tx *libdata.Transaction, tenant *libdata.Tenant) (*libdata.Tenant, error)
- func (d *Driver) InitDB(writeInfo *libdata.ClusterInfo, readInfo *libdata.ClusterInfo) (*libdata.Cluster, error)
- func (d *Driver) Insert(ctx context.Context, tx *libdata.Transaction, t *libdata.ModelDefinition, ...) (interface{}, error)
- func (d *Driver) RegisterEvent(tx *libdata.Transaction, aggregate string, aggregateUUID string, name string, ...) (libdata.EventInterface, error)
- func (d *Driver) RollbackTransaction(tx *libdata.Transaction) error
- func (d *Driver) Select(ctx context.Context, tx *libdata.Transaction, model *libdata.ModelDefinition, ...) (interface{}, error)
- func (d *Driver) Update(ctx context.Context, tx *libdata.Transaction, t *libdata.ModelDefinition, ...) (interface{}, error)
- type Store
- type Tx
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Driver ¶
type Driver struct{}
Driver contains all the function needed to be recognized as a libdata driver
func (*Driver) BeginTransaction ¶
func (d *Driver) BeginTransaction( c *libdata.Cluster, tenant *libdata.Tenant, useCache bool, ) (*libdata.Transaction, error)
BeginTransaction will create a new transaction and return it.
func (*Driver) CommitTransaction ¶
func (d *Driver) CommitTransaction(tx *libdata.Transaction) error
CommitTransaction will definitely save all the operations in the transaction.
func (*Driver) CreateTenant ¶
CreateTenant will create the tenant in postgres, either a new schema or a new tenant record
func (*Driver) Delete ¶
func (d *Driver) Delete( ctx context.Context, tx *libdata.Transaction, model *libdata.ModelDefinition, filters []*libdata.Filter, ) error
Delete will delete the filtered records.
func (*Driver) GenerateScanFunc ¶
func (d *Driver) GenerateScanFunc(model *libdata.ModelDefinition) string
func (*Driver) GetTenant ¶
func (d *Driver) GetTenant( tx *libdata.Transaction, tenant *libdata.Tenant, ) (*libdata.Tenant, error)
GetTenant will return the tenant.
func (*Driver) InitDB ¶
func (d *Driver) InitDB( writeInfo *libdata.ClusterInfo, readInfo *libdata.ClusterInfo, ) (*libdata.Cluster, error)
InitDB will connect to the postgres database and return the connection
func (*Driver) Insert ¶
func (d *Driver) Insert( ctx context.Context, tx *libdata.Transaction, t *libdata.ModelDefinition, records []libdata.ModelInterface, ) (interface{}, error)
Insert will insert the new record in the database.
func (*Driver) RegisterEvent ¶
func (d *Driver) RegisterEvent( tx *libdata.Transaction, aggregate string, aggregateUUID string, name string, payload []byte, ) (libdata.EventInterface, error)
RegisterEvent will register the event in the event model.
func (*Driver) RollbackTransaction ¶
func (d *Driver) RollbackTransaction(tx *libdata.Transaction) error
RollbackTransaction will cancel all the operations in the transaction.
func (*Driver) Select ¶
func (d *Driver) Select( ctx context.Context, tx *libdata.Transaction, model *libdata.ModelDefinition, filters []*libdata.Filter, limit *uint, orderBy []*libdata.OrderByInput, ) (interface{}, error)
Select will return the filtered records.
type Store ¶
type Store interface { InsertBuildArgs([]libdata.ModelInterface) ([]string, map[string]interface{}) UpdateBuildArgs(interface{}, *fieldmask.FieldMask) ([]string, map[string]interface{}) }
Store is an interface containing the functions needed to build the arguments specifics to the model type.