dynamo

package
v1.60.5 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: AGPL-3.0, AGPL-3.0-or-later Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MarshalJSONGZ added in v1.59.0

func MarshalJSONGZ(v any) ([]byte, error)

func UnmarshalJSONGZ added in v1.59.0

func UnmarshalJSONGZ(d []byte, v any) error

Types

type Marshaler added in v1.59.0

type Marshaler interface {
	MarshalDynamo() (map[string]types.AttributeValue, error)
}

type Service

type Service struct {
	Client *dynamodb.Client
	// contains filtered or unexported fields
}

Service is simple abstraction layer to work with a DynamoDB-compatible database

func NewService

func NewService(accessKey, secretKey, region, endpoint, tablePrefix string) (*Service, error)

NewService creates a new dynamodb service with the given credentials and configuration

func (*Service) GetItem added in v1.59.0

func (s *Service) GetItem(ctx context.Context, table string, key map[string]types.AttributeValue, dst any) error

GetItem retrieves an item from the given table

func (*Service) PutItem added in v1.59.0

func (s *Service) PutItem(ctx context.Context, table string, v any) error

PutItem puts an item into the given table

func (*Service) TableName

func (s *Service) TableName(base string) string

TableName returns the full table name with the prefix

func (*Service) Test

func (s *Service) Test(ctx context.Context) error

Test checks if the service is working by trying to list tables

type Unmarshaler added in v1.59.0

type Unmarshaler interface {
	UnmarshalDynamo(map[string]types.AttributeValue) error
}

Jump to

Keyboard shortcuts

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