goety

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: May 12, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DynamoClient

type DynamoClient interface {
	Put(ctx context.Context, input *dynamodb.PutItemInput) (*dynamodb.PutItemOutput, error)
	Scan(ctx context.Context, input *dynamodb.ScanInput) (*dynamodb.ScanOutput, error)
	BatchDeleteItems(ctx context.Context, tableName string, keys []map[string]types.AttributeValue) (*dynamodb.BatchWriteItemOutput, error)
}

type Emitter added in v0.0.4

type Emitter interface {
	Publish(msg string)
}

type QueryFuncOpts added in v0.2.0

type QueryFuncOpts = func(*QueryOpts) *QueryOpts

func WithAttrs added in v0.2.0

func WithAttrs(attrs []string) QueryFuncOpts

WithAttrs - provide a list of dynamodb attributes the query will return

func WithFilterExpression added in v0.2.0

func WithFilterExpression(condition string) QueryFuncOpts

WithFilterExpression - provide a filter condition for the query

func WithFilterNameAttrs added in v0.2.0

func WithFilterNameAttrs(attrName string) QueryFuncOpts

WithFilterNameAttrs - provide a list of attribute names to filter on

func WithFilterNameValues added in v0.2.0

func WithFilterNameValues(attrValues string) QueryFuncOpts

WithFilterNameValues - provide a list of attribute values to filter on

func WithLimit added in v0.2.0

func WithLimit(limit int32) QueryFuncOpts

WithLimit - provide a limit to the query

type QueryOpts added in v0.2.0

type QueryOpts struct {
	Limit                *int32
	FilterExpression     *string
	ProjectedExpressions *string
	FilterNameAttributes map[string]string
	FilterNameValues     map[string]types.AttributeValue
}

func WithQueryOptions added in v0.2.0

func WithQueryOptions(opts []QueryFuncOpts) *QueryOpts

type Service

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

func New

func New(client DynamoClient, logger *slog.Logger, emitter emitter.MessagePublisher, dryRun bool) Service

func (Service) Dump added in v0.0.4

func (s Service) Dump(ctx context.Context, tableName string, path string, opts ...QueryFuncOpts) error

Dump all items from the given table. Optionally specify a list of attributes to extract.

Example:

Dump(ctx, "my-table", "path/to/file.json", []string{"attr1", "attr2"})

func (Service) Purge

func (s Service) Purge(ctx context.Context, tableName string, keys TableKeys) error

Purge all items from the given table

Example:

Purge(ctx, "my-table", TableKeys{ PartitionKey: "pk", SortKey: "sk" })

func (Service) Seed added in v0.2.0

func (s Service) Seed(ctx context.Context, tableName string, filePath string) error

Seed a table with items from a json file

Example:

Seed(ctx, "my-table", "path/to/file.json")

type TableKeys

type TableKeys struct {
	PartitionKey string
	SortKey      string
}

type WriteFile added in v0.0.4

type WriteFile struct {
}

func (*WriteFile) ReadFile added in v0.2.0

func (w *WriteFile) ReadFile(name string) ([]byte, error)

func (*WriteFile) WriteFile added in v0.0.4

func (w *WriteFile) WriteFile(name string, data []byte, perm fs.FileMode) error

WriteFile saves data to a file.

Jump to

Keyboard shortcuts

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