postgres

package
v0.0.0-...-86e84b6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 6, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientInfo

type ClientInfo struct {
	URL string
}

type DBRequestError

type DBRequestError struct {
	Q string
	N string
	R string
}

DBRequestError is an error returned when the database return an error.

func (*DBRequestError) Error

func (e *DBRequestError) Error() string

Error return the error message.

type DBUnrecognizedOperatorError

type DBUnrecognizedOperatorError struct {
	O string
}

DBUnrecognizedOperatorError is an error returned when you use a non existing operator in filter.

func (*DBUnrecognizedOperatorError) Error

Error return the error message.

type Driver

type Driver struct {
	InsertCustom func(
		*Driver,
		libdomain.TableInterface, *libapplication.Workflow, []interface{},
		func([]interface{}) ([]string, map[string]interface{}),
		[]string,
	) (interface{}, error)
	// contains filtered or unexported fields
}

Driver contains all the function needed to be recognized as a libdata driver

func NewClient

func NewClient(info *ClientInfo) (*Driver, error)

func (*Driver) BeginTransaction

func (d *Driver) BeginTransaction(
	wf *libapplication.Workflow, useCache bool,
) error

BeginTransaction will create a new transaction and return it.

func (*Driver) Close

func (c *Driver) Close()

func (*Driver) CommitOrchestratorTransaction

func (c *Driver) CommitOrchestratorTransaction(tx interface{})

func (*Driver) CommitTransaction

func (d *Driver) CommitTransaction(wk *libapplication.Workflow) error

CommitTransaction will definitely save all the operations in the transaction.

func (*Driver) Delete

func (d *Driver) Delete(
	model libdomain.TableInterface,
	wk *libapplication.Workflow, filters []*librepository.Filter,
) error

Delete will delete the filtered records.

func (*Driver) GenerateScanFunc

func (d *Driver) GenerateScanFunc(table libdomain.TableInterface) string

func (*Driver) Get

func (d *Driver) Get(
	t *libdomain.EntityDefinition,
	wk *libapplication.Workflow, id string,
) (interface{}, error)

Select will return the filtered records.

func (*Driver) GetAggregateEvents

func (d *Driver) GetAggregateEvents(
	wk libdomain.WorkflowInterface,
	a libdomain.AggregateInterface, id string,
) ([]*libdomain.Event, error)

func (*Driver) GetConnection

func (d *Driver) GetConnection() *sqlx.DB

func (*Driver) GetImportRepository

func (d *Driver) GetImportRepository() string

func (*Driver) GetOrchestratorTransaction

func (c *Driver) GetOrchestratorTransaction() interface{}

func (*Driver) GetWorkflow

func (c *Driver) GetWorkflow(id string) (
	string, string, []byte, []byte, error,
)

func (*Driver) Insert

func (d *Driver) Insert(
	t libdomain.TableInterface, wk *libapplication.Workflow, records []interface{},
	insertBuildArgs func([]interface{}) ([]string, map[string]interface{}),
	properties []string,
) (interface{}, error)

func (*Driver) InsertDefault

func (d *Driver) InsertDefault(
	t libdomain.TableInterface, wk *libapplication.Workflow, records []interface{},
	insertBuildArgs func([]interface{}) ([]string, map[string]interface{}),
	properties []string,
) (interface{}, error)

Insert will insert the new record in the database.

func (*Driver) MarkDispatchedEvent

func (d *Driver) MarkDispatchedEvent(
	wk libdomain.WorkflowInterface,
	event *libdomain.Event,
) error

func (*Driver) MigrateAggregate

func (d *Driver) MigrateAggregate(
	aggregates []*libdomain.AggregateDefinition,
) error

nolint: gocyclo

func (*Driver) NewWorkflow

func (c *Driver) NewWorkflow(
	name string, idempotencyKey string, serializedArgs []byte,
) (string, error)

func (*Driver) OnActivitySuccess

func (c *Driver) OnActivitySuccess(workflowUUID string, step int, serializedResult []byte) error

func (*Driver) OnWorkflowError

func (c *Driver) OnWorkflowError(name string) error

func (*Driver) OnWorkflowSuccess

func (c *Driver) OnWorkflowSuccess(name string, serializedResult []byte) error

func (*Driver) RegisterEvents

func (d *Driver) RegisterEvents(
	wk libdomain.WorkflowInterface,
	a libdomain.AggregateInterface,
	events []*libdomain.Event) error

RegisterEvent will register the event in the event model.

func (*Driver) RollbackOrchestratorTransaction

func (c *Driver) RollbackOrchestratorTransaction(tx interface{})

func (*Driver) RollbackTransaction

func (d *Driver) RollbackTransaction(wk *libapplication.Workflow) error

RollbackTransaction will cancel all the operations in the transaction.

func (*Driver) SearchActivity

func (c *Driver) SearchActivity(
	workflowUUID string, step int,
) ([]byte, error)

func (*Driver) SearchWorkflow

func (c *Driver) SearchWorkflow(idempotencyKey string) (string, error)

func (*Driver) Select

func (d *Driver) Select(
	model libdomain.TableInterface, wk *libapplication.Workflow,
	filters []*librepository.Filter, properties []string, options *basepb.OptionsListQuery,
) (interface{}, error)

Select will return the filtered records.

func (*Driver) SupportTransaction

func (d *Driver) SupportTransaction() bool

func (*Driver) Update

func (d *Driver) Update(
	t libdomain.TableInterface, wk *libapplication.Workflow,
	filters []*librepository.Filter, record interface{}, updateMask *fieldmask.FieldMask,
	updateBuildArgs func(interface{}, *fieldmask.FieldMask) ([]string, map[string]interface{}),
	properties []string,
) (interface{}, error)

Update will update the data in the filtered records.

type InsertActivity

type InsertActivity struct {
	Workflow *libapplication.Workflow
	Query    string
	Args     map[string]interface{}
}

func (*InsertActivity) MarshalArgs

func (a *InsertActivity) MarshalArgs() ([]byte, error)

func (*InsertActivity) MarshalResult

func (a *InsertActivity) MarshalResult(result interface{}) ([]byte, error)

func (*InsertActivity) Run

func (a *InsertActivity) Run(
	ctx context.Context,
) (interface{}, error)

func (*InsertActivity) UnmarshalArgs

func (a *InsertActivity) UnmarshalArgs(data []byte) error

func (*InsertActivity) UnmarshalResult

func (a *InsertActivity) UnmarshalResult(data []byte, resultInterface interface{}) error

type Tx

type Tx struct {
	Sqlx *sqlx.Tx
}

Tx contains all the function needed to be recognized as a libdata Tx

func (*Tx) Exec

func (tx *Tx) Exec(query string, args interface{}) error

Exec will execute the specified query in this transaction.

func (*Tx) QueryRows

func (tx *Tx) QueryRows(q string, args interface{}) (*sqlx.Rows, error)

QueryRows will execute the specified query in this transaction and return the records.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL