tx

package
v1.1.8 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2019 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSagatableName added in v1.1.0

func GetSagatableName(svcName string) string

GetSagatableName returns the table name in which to store the Sagas

func GrabbitTableNameTemplate added in v1.1.1

func GrabbitTableNameTemplate(svcName, table string) string

GrabbitTableNameTemplate returns the tamplated grabbit table name for the table type and service

func SanitizeTableName added in v1.1.1

func SanitizeTableName(dirty string) string

SanitizeTableName returns a sanitizes and lower cased string for creating a table

Types

type Provider

type Provider struct {
	Database *sql.DB
}

Provider for PostgreSQL or MySQ

func (*Provider) Dispose

func (provider *Provider) Dispose()

Dispose database connections

func (*Provider) New

func (provider *Provider) New() (*sql.Tx, error)

New transaction

func (*Provider) Ping

func (provider *Provider) Ping(timeoutInSeconds time.Duration) bool

Ping checks if the provider is available and timeouts according to the given duration

type SagaStore

type SagaStore struct {
	*gbus.Glogged
	Tx            gbus.TxProvider
	SvcName       string
	ParamsMarkers []string
}

SagaStore base type for embedding for new transactional saga stores

func (*SagaStore) DeleteSaga

func (store *SagaStore) DeleteSaga(tx *sql.Tx, instance *saga.Instance) error

DeleteSaga implements interface method store.DeleteSaga

func (*SagaStore) GetSagaByID

func (store *SagaStore) GetSagaByID(tx *sql.Tx, sagaID string) (*saga.Instance, error)

GetSagaByID implements interface method store.GetSagaByID

func (*SagaStore) GetSagasByType

func (store *SagaStore) GetSagasByType(tx *sql.Tx, sagaType reflect.Type) (instances []*saga.Instance, err error)

GetSagasByType implements interface method store.GetSagasByType

func (*SagaStore) NewTx

func (store *SagaStore) NewTx() *sql.Tx

NewTx creates a new transaction from the underlying TxProvider

func (*SagaStore) Purge

func (store *SagaStore) Purge() error

Purge cleans up the saga store, to be used in tests and in extreme situations in production

func (*SagaStore) RegisterSagaType

func (store *SagaStore) RegisterSagaType(saga gbus.Saga)

RegisterSagaType implements interface method store.RegisterSagaType

func (*SagaStore) SaveNewSaga

func (store *SagaStore) SaveNewSaga(tx *sql.Tx, sagaType reflect.Type, newInstance *saga.Instance) (err error)

SaveNewSaga implements interface method store.SaveNewSaga

func (*SagaStore) UpdateSaga

func (store *SagaStore) UpdateSaga(tx *sql.Tx, instance *saga.Instance) (err error)

UpdateSaga implements interface method store.UpdateSaga

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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