transactions

package
v0.1.18 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxGetItems = 100
)
View Source
const (
	MaxItems = 100
)

Variables

View Source
var NotBegan = errors.New("Transaction not began")

Functions

func Begin added in v0.1.13

func Begin(ctx context.Context, db Client, opt ...options.Option) context.Context

func DelayedDelete added in v0.1.13

func DelayedDelete(ctx context.Context, keys ...foundations.WriteItemFunc)

func DelayedPut added in v0.1.13

func DelayedPut(ctx context.Context, keys ...foundations.WriteItemFunc)

func DelayedUpdate added in v0.1.13

func DelayedUpdate(ctx context.Context, keys ...foundations.WriteItemFunc)

func Delete added in v0.1.13

func Delete(ctx context.Context, keys ...foundations.WriteItemFunc)

func FailSafe added in v0.1.17

func FailSafe() options.Option

func Limit added in v0.1.17

func Limit(limit int) options.Option

func Put added in v0.1.13

func Put(ctx context.Context, keys ...foundations.WriteItemFunc)

func Run added in v0.1.13

func Update added in v0.1.13

func Update(ctx context.Context, keys ...foundations.WriteItemFunc)

func With added in v0.1.13

func With(ctx context.Context, f func(t *Builder))

Types

type Builder

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

func New

func New(opt ...options.Option) *Builder

func (*Builder) DelayedDelete added in v0.1.9

func (builder *Builder) DelayedDelete(keys ...foundations.WriteItemFunc) *Builder

func (*Builder) DelayedPut added in v0.1.9

func (builder *Builder) DelayedPut(keys ...foundations.WriteItemFunc) *Builder

func (*Builder) DelayedUpdate added in v0.1.9

func (builder *Builder) DelayedUpdate(keys ...foundations.WriteItemFunc) *Builder

func (*Builder) Delete

func (builder *Builder) Delete(keys ...foundations.WriteItemFunc) *Builder

Delete 削除用

func (*Builder) Error

func (builder *Builder) Error() error

func (*Builder) HasError

func (builder *Builder) HasError() bool

func (*Builder) Monitor added in v0.1.15

func (builder *Builder) Monitor(monitor Monitor) *Builder

func (*Builder) Put

func (builder *Builder) Put(keys ...foundations.WriteItemFunc) *Builder

Put 追加用

func (*Builder) Run

func (builder *Builder) Run(ctx context.Context, cli Client) (out *dynamodb.TransactWriteItemsOutput, err error)

func (*Builder) Update

func (builder *Builder) Update(keys ...foundations.WriteItemFunc) *Builder

Update 更新用

type Client

type Client interface {
	TransactWriteItems(ctx context.Context, params *dynamodb.TransactWriteItemsInput, optFns ...func(*dynamodb.Options)) (*dynamodb.TransactWriteItemsOutput, error)
	TransactGetItems(ctx context.Context, params *dynamodb.TransactGetItemsInput, optFns ...func(*dynamodb.Options)) (*dynamodb.TransactGetItemsOutput, error)
}

type Context added in v0.1.13

type Context struct {
	*Builder `json:"-" dynamodbav:"-"`
	// contains filtered or unexported fields
}

func From added in v0.1.13

func From(ctx context.Context) (*Context, bool)

func (*Context) DB added in v0.1.13

func (t *Context) DB() Client

type GetBuilder added in v0.0.9

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

func Get added in v0.0.9

func Get(keys ...foundations.GetItemFunc) *GetBuilder

func (*GetBuilder) HasError added in v0.0.9

func (builder *GetBuilder) HasError() bool

func (*GetBuilder) Run added in v0.0.9

type Monitor added in v0.1.15

type Monitor func(items []types.TransactWriteItem, err error)

type Transaction

type Transaction interface {
	PutItem(ctx context.Context, expiredAt ...time.Time) foundations.WriteItemFunc
	DeleteItem(ctx context.Context) foundations.WriteItemFunc
	UpdateItem(ctx context.Context, fields ...foundations.UpdateField) foundations.WriteItemFunc
}

Jump to

Keyboard shortcuts

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