s3

package
v0.0.0-...-461d331 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Codec

type Codec[T dynamo.Thing] struct {
	// contains filtered or unexported fields
}

Codec is utility to encode/decode objects to s3 representation

func NewCodec

func NewCodec[T dynamo.Thing](prefixes curie.Prefixes) *Codec[T]

func (Codec[T]) EncodeKey

func (codec Codec[T]) EncodeKey(key T) string

type Schema

type Schema[T dynamo.Thing] struct{ hseq.Seq[T] }

Schema is utility that merges two struct

func NewSchema

func NewSchema[T dynamo.Thing]() *Schema[T]

func (Schema[T]) Merge

func (schema Schema[T]) Merge(a, b T) (c T)

type Storage

type Storage[T dynamo.Thing] struct {
	Service dynamo.S3
	Bucket  *string
	Codec   *Codec[T]
	Schema  *Schema[T]
	// contains filtered or unexported fields
}

ds3 is a S3 client

func (*Storage[T]) Get

func (db *Storage[T]) Get(ctx context.Context, key T) (T, error)

Get item from storage

func (*Storage[T]) Match

func (db *Storage[T]) Match(ctx context.Context, key T) dynamo.Seq[T]

Match applies a pattern matching to elements in the bucket

func (*Storage[T]) Put

func (db *Storage[T]) Put(ctx context.Context, entity T, config ...dynamo.Constraint[T]) error

Put writes entity

func (*Storage[T]) Remove

func (db *Storage[T]) Remove(ctx context.Context, key T, config ...dynamo.Constraint[T]) error

Remove discards the entity from the table

func (*Storage[T]) Update

func (db *Storage[T]) Update(ctx context.Context, entity T, config ...dynamo.Constraint[T]) (T, error)

Update applies a partial patch to entity and returns new values

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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