opaquedata

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

func GetTTL

func GetTTL(ttl time.Duration) int64

func NewOpaqueDataFromProto

func NewOpaqueDataFromProto(msg AutoPKSK, opts ...Option) (*opaquedatav1.OpaqueData, error)

func NewOpaqueKeyFromProto

func NewOpaqueKeyFromProto(msg AutoPKSK) *opaquedatav1.OpaqueData

func ReHydrate

func ReHydrate(od *opaquedatav1.OpaqueData, target Hydrater) error

Types

type AutoPKSK

type AutoPKSK interface {
	proto.Message
	PK() string
	SK() string
	GSI1PK() string
	GSI1SK() string
	GSI2PK() string
	GSI2SK() string
	GSI3PK() string
	GSI3SK() string
	GSI4PK() string
	GSI4SK() string
	GSI5PK() string
	GSI5SK() string
	GSI6PK() string
	GSI6SK() string
	GSI7PK() string
	GSI7SK() string
	GSI8PK() string
	GSI8SK() string
	GSI9PK() string
	GSI9SK() string
	GSI10PK() string
	GSI10SK() string
	GSI11PK() string
	GSI11SK() string
	GSI12PK() string
	GSI12SK() string
	GSI13PK() string
	GSI13SK() string
	GSI14PK() string
	GSI14SK() string
	GSI15PK() string
	GSI15SK() string
	GSI16PK() string
	GSI16SK() string
	GSI17PK() string
	GSI17SK() string
	GSI18PK() string
	GSI18SK() string
	GSI19PK() string
	GSI19SK() string
	GSI20PK() string
	GSI20SK() string
}

type Hydrater

type Hydrater interface {
	proto.Message
	Hydrate(body []byte) error
}

type OpaqueDataOptions

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

type OpaqueStore

type OpaqueStore interface {
	Put(ctx context.Context, od *opaquedatav1.OpaqueData) error
	Get(ctx context.Context, pk, sk string) (*opaquedatav1.OpaqueData, error)
	Delete(ctx context.Context, pk, sk string) error
	Query(ctx context.Context, pkAttr, pkValue, skAttr string, sort *SortCondition, opts ...QueryOption) ([]*opaquedatav1.OpaqueData, error)
}

OpaqueStore is the interface that store adapters implement to persist and retrieve OpaqueData projections. Each adapter maps OpaqueData fields to its native storage format (DynamoDB items, Cosmos containers, etc.).

type Option

type Option func(*OpaqueDataOptions)

func WithCompressThreshold

func WithCompressThreshold(threshold int) Option

WithCompressThreshold overrides the compression threshold (in bytes) for proto body data. Data at or above this size is gzip-compressed before storage. Pass 0 or a negative value to disable compression. The default is 300 bytes.

func WithTTL

func WithTTL(ttl time.Duration) Option

type QueryOption

type QueryOption func(*QueryOptions)

QueryOption configures a query.

func WithGSIIndex

func WithGSIIndex(n int) QueryOption

WithGSIIndex directs the query to the specified GSI (1-20).

type QueryOptions

type QueryOptions struct {
	GSIIndex int // 0 = main table, 1-20 = GSI index
}

QueryOptions holds resolved query parameters. Exported so store adapters can read them; callers should use the functional option constructors.

func ApplyQueryOptions

func ApplyQueryOptions(opts []QueryOption) QueryOptions

ApplyQueryOptions resolves a slice of QueryOption into QueryOptions.

type SortCondition

type SortCondition struct {
	Operator SortOperator
	Value    string
	Value2   string // only used by Between
}

SortCondition describes a sort key filter for queries.

type SortOperator

type SortOperator int

SortOperator defines the comparison operator for sort key conditions.

const (
	Equal      SortOperator = iota
	Lt                      // <
	Le                      // <=
	Gt                      // >
	Ge                      // >=
	Between                 // BETWEEN value AND value2
	BeginsWith              // begins_with
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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