gotx

package
v0.0.0-...-4e871e4 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewTransactor

func NewTransactor(spannerClient *spanner.Client) gotx.Transactor

func NewTransactorWithConfig

func NewTransactorWithConfig(spannerClient *spanner.Client, config TransactorConfig) gotx.Transactor

Types

type Client

type Client interface {
	Reader(ctx context.Context) Reader
	ApplyOrBufferWrite(context.Context, ...*spanner.Mutation) error
	Update(ctx context.Context, statement spanner.Statement) (int64, error)
	UpdateWithOption(ctx context.Context, statement spanner.Statement, options spanner.QueryOptions) (int64, error)
	BatchUpdate(ctx context.Context, statement []spanner.Statement) ([]int64, error)
	PartitionedUpdate(ctx context.Context, statement spanner.Statement) (int64, error)
	PartitionedUpdateWithOptions(ctx context.Context, statement spanner.Statement, options spanner.QueryOptions) (int64, error)
}

type ClientFactory

type ClientFactory interface {
	NewClient(client *spanner.Client, rw *spanner.ReadWriteTransaction, ro *spanner.ReadOnlyTransaction) Client
}

type ClientProvider

type ClientProvider interface {
	CurrentClient(ctx context.Context) Client
}

func NewDefaultClientProvider

func NewDefaultClientProvider(client *spanner.Client) ClientProvider

func NewDefaultClientProviderWithFactory

func NewDefaultClientProviderWithFactory(client *spanner.Client, factory ClientFactory) ClientProvider

type DefaultClient

type DefaultClient struct {
	// contains filtered or unexported fields
}

func (*DefaultClient) ApplyOrBufferWrite

func (e *DefaultClient) ApplyOrBufferWrite(ctx context.Context, data ...*spanner.Mutation) error

func (*DefaultClient) BatchUpdate

func (e *DefaultClient) BatchUpdate(ctx context.Context, stmts []spanner.Statement) ([]int64, error)

func (*DefaultClient) PartitionedUpdate

func (e *DefaultClient) PartitionedUpdate(ctx context.Context, stmt spanner.Statement) (int64, error)

func (*DefaultClient) PartitionedUpdateWithOptions

func (e *DefaultClient) PartitionedUpdateWithOptions(ctx context.Context, stmt spanner.Statement, options spanner.QueryOptions) (int64, error)

func (*DefaultClient) Reader

func (e *DefaultClient) Reader(_ context.Context) Reader

func (*DefaultClient) Update

func (e *DefaultClient) Update(ctx context.Context, stmt spanner.Statement) (int64, error)

func (*DefaultClient) UpdateWithOption

func (e *DefaultClient) UpdateWithOption(ctx context.Context, stmt spanner.Statement, opts spanner.QueryOptions) (int64, error)

type DefaultClientFactory

type DefaultClientFactory struct {
}

func (*DefaultClientFactory) NewClient

type DefaultClientProvider

type DefaultClientProvider struct {
	// contains filtered or unexported fields
}

func (*DefaultClientProvider) CurrentClient

func (p *DefaultClientProvider) CurrentClient(ctx context.Context) Client

type Reader

type Reader interface {
	Read(ctx context.Context, table string, keys spanner.KeySet, columns []string) *spanner.RowIterator
	ReadUsingIndex(ctx context.Context, table, index string, keys spanner.KeySet, columns []string) (ri *spanner.RowIterator)
	Query(ctx context.Context, statement spanner.Statement) *spanner.RowIterator
	QueryWithOptions(ctx context.Context, statement spanner.Statement, opts spanner.QueryOptions) *spanner.RowIterator
	QueryWithStats(ctx context.Context, statement spanner.Statement) *spanner.RowIterator
	ReadRow(ctx context.Context, table string, key spanner.Key, columns []string) (*spanner.Row, error)
}

------------------------------------ Client ------------------------------------

type TransactionOptions

type TransactionOptions spanner.TransactionOptions

func OptionTransactionOptions

func OptionTransactionOptions(options spanner.TransactionOptions) TransactionOptions

func (TransactionOptions) Apply

func (o TransactionOptions) Apply(c *gotx.Config)

type Transactor

type Transactor struct {
	// contains filtered or unexported fields
}

func (*Transactor) Required

func (t *Transactor) Required(ctx context.Context, fn gotx.DoInTransaction, options ...gotx.Option) error

func (*Transactor) RequiresNew

func (t *Transactor) RequiresNew(ctx context.Context, fn gotx.DoInTransaction, options ...gotx.Option) error

type TransactorConfig

type TransactorConfig struct {
	ClientFactory ClientFactory
	OnCommit      func(commitResponse *spanner.CommitResponse)
}

Jump to

Keyboard shortcuts

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