dynamo

package
v0.0.0-...-15cdbb1 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2023 License: Apache-2.0 Imports: 10 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound = errors.New("entity not found")
)

Functions

This section is empty.

Types

type Conn

type Conn[T Serializable[T]] struct {
	// contains filtered or unexported fields
}

Conn is the connection to the Dynamodb

func New

func New[T Serializable[T]](conf DBConf) *Conn[T]

func (*Conn[T]) Create

func (conn *Conn[T]) Create(ctx context.Context, r T) (T, error)

func (*Conn[T]) FindAll

func (conn *Conn[T]) FindAll(ctx context.Context, filter query.Opts) ([]T, error)

func (*Conn[T]) FindByID

func (conn *Conn[T]) FindByID(ctx context.Context, id string) (T, error)

func (*Conn[T]) FindByPk

func (conn *Conn[T]) FindByPk(ctx context.Context, pk string, filter query.Opts) ([]T, error)

func (*Conn[T]) FindByPkAndSk

func (conn *Conn[T]) FindByPkAndSk(ctx context.Context, pk string, sk string) (T, error)

type DBConf

type DBConf struct {
	TableName string
}

type Serializable

type Serializable[T any] interface {
	Serialize() (map[string]types.AttributeValue, error)
	Deserialize(map[string]types.AttributeValue) (T, error)
	DeserializeList([]map[string]types.AttributeValue) ([]T, error)
	PK() string
	SK(*string) string
}

Jump to

Keyboard shortcuts

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