Documentation
¶
Overview ¶
Package driver defines the interface for database service implementations.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Database ¶
type Database interface {
CreateTable(ctx context.Context, config TableConfig) error
DeleteTable(ctx context.Context, name string) error
DescribeTable(ctx context.Context, name string) (*TableConfig, error)
ListTables(ctx context.Context) ([]string, error)
PutItem(ctx context.Context, table string, item map[string]any) error
GetItem(ctx context.Context, table string, key map[string]any) (map[string]any, error)
DeleteItem(ctx context.Context, table string, key map[string]any) error
Query(ctx context.Context, input QueryInput) (*QueryResult, error)
Scan(ctx context.Context, input ScanInput) (*QueryResult, error)
BatchPutItems(ctx context.Context, table string, items []map[string]any) error
BatchGetItems(ctx context.Context, table string, keys []map[string]any) ([]map[string]any, error)
}
Database is the interface that database provider implementations must satisfy.
type KeyCondition ¶
type KeyCondition struct {
PartitionKey string
PartitionVal any
SortOp string // "=", "<", ">", "<=", ">=", "BETWEEN", "BEGINS_WITH"
SortVal any
SortValEnd any // for BETWEEN
}
KeyCondition defines a key condition for queries.
type QueryInput ¶
type QueryInput struct {
Table string
IndexName string
KeyCondition KeyCondition
Limit int
PageToken string
ScanForward bool
}
QueryInput configures a query operation.
type QueryResult ¶
QueryResult is the result of a query or scan.
type ScanFilter ¶
type ScanFilter struct {
Field string
Op string // "=", "!=", "<", ">", "<=", ">=", "CONTAINS", "BEGINS_WITH"
Value any
}
ScanFilter defines a scan filter.
Click to show internal directories.
Click to hide internal directories.