dynamo

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete

func Delete(tableName, key string, sortKey ...string) error

func Get

func Get[T any](tableName string, key string, sortKey ...string) (*T, error)

func GetDynamoClient

func GetDynamoClient(region string) (*dynamodb.Client, error)

func GetInt

func GetInt(tableName, key string) (int, error)

func GetString

func GetString(tableName, key string) (string, error)

func Put

func Put(tableName, key string, value any, options ...SetOptions) error

func Query

func Query[T any](tableName string, key string, options ...QueryOptions) ([]T, error)

Types

type DbOptions

type DbOptions struct {
	Region                string
	TableName             string
	PartitionKeyAttribute string
	TtlAttribute          string
	SortKeyAttribute      string
	ValueStoreMode        ValueStoreMode
	ValueAttribute        string
	Ttl                   time.Duration
}

type DynamoDB

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

func New

func New(options ...DbOptions) (*DynamoDB, error)

func (*DynamoDB) Delete

func (d *DynamoDB) Delete(key string, sortKey ...string) error

func (*DynamoDB) Get

func (d *DynamoDB) Get(key string, options ...GetOptions) (interface{}, error)

func (*DynamoDB) Put

func (d *DynamoDB) Put(key string, value any, options ...SetOptions) error

func (*DynamoDB) Query

func (d *DynamoDB) Query(key string, options ...QueryOptions) ([]interface{}, error)

func (*DynamoDB) Update

func (d *DynamoDB) Update(key string, value any, options ...SetOptions) error

type GetOptions

type GetOptions struct {
	SortKey string
	Result  any
}

type QueryCondition

type QueryCondition string
const (
	QueryConditionNone                 QueryCondition = "none"
	QueryConditionBeginsWith           QueryCondition = "beginsWith"
	QueryConditionEndsWith             QueryCondition = "endsWith"
	QueryConditionContains             QueryCondition = "contains"
	QueryConditionEquals               QueryCondition = "equals"
	QueryConditionNotEquals            QueryCondition = "notEquals"
	QueryConditionGreaterThan          QueryCondition = "greaterThan"
	QueryConditionLessThan             QueryCondition = "lessThan"
	QueryConditionGreaterThanOrEqualTo QueryCondition = "greaterThanOrEqualTo"
	QueryConditionLessThanOrEqualTo    QueryCondition = "lessThanOrEqualTo"
)

type QueryOptions

type QueryOptions struct {
	Result                any
	SortKey               string
	PartitionKeyCondition QueryCondition
	SortKeyCondition      QueryCondition
	Limit                 int
}

type SetOptions

type SetOptions struct {
	Ttl     time.Duration
	SortKey string
}

type ValueStoreMode

type ValueStoreMode string
const (
	ValueStoreModeJson       ValueStoreMode = "json"
	ValueStoreModeAttributes ValueStoreMode = "attributes"
)

Jump to

Keyboard shortcuts

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