TableTheory API Reference
This reference is generated from Go source with go doc -short. Do not hand-edit signatures here; run make generate-api-reference.
Runtime peers: TypeScript · Python
Drift check
make verify-api-reference
Go packages
github.com/theory-cloud/tabletheory/v2
var WithBackupTable = schema.WithBackupTable ...
func AtVersion(version int64) core.TransactCondition
func Condition(field, operator string, value any) core.TransactCondition
func ConditionExpression(expression string, values map[string]any) core.TransactCondition
func ConditionVersion(version int64) core.TransactCondition
func DefaultBatchGetOptions() *core.BatchGetOptions
func EnableXRayTracing() bool
func GetLambdaMemoryMB() int
func GetPartnerFromContext(ctx context.Context) string
func GetRemainingTimeMillis(ctx context.Context) int64
func IfExists() core.TransactCondition
func IfNotExists() core.TransactCondition
func IsLambdaEnvironment() bool
func ModelOf[T any](db core.DB) typed.Model[T]
func New(config session.Config) (core.ExtendedDB, error)
func NewBasic(config session.Config) (core.DB, error)
func NewKeyPair(partitionKey any, sortKey ...any) core.KeyPair
func NewTypedKey[T any](partitionKey any, sortKey ...any) typed.Key[T]
func NewWithClient(config session.Config, client session.DynamoDBAPI) (core.ExtendedDB, error)
func PartnerContext(ctx context.Context, partnerID string) context.Context
func UnmarshalItem(item map[string]types.AttributeValue, dest interface{}) error
func UnmarshalItems(items []map[string]types.AttributeValue, dest interface{}) error
func UnmarshalStreamImage(streamImage map[string]events.DynamoDBAttributeValue, dest interface{}) error
type AccountConfig = internaltheorydb.AccountConfig
type AutoMigrateOption = schema.AutoMigrateOption
type BatchGetOptions = core.BatchGetOptions
type ColdStartMetrics = internaltheorydb.ColdStartMetrics
func BenchmarkColdStart(models ...any) ColdStartMetrics
type Config = session.Config
type DB = internaltheorydb.DB
type DynamoDBAPI = session.DynamoDBAPI
type KeyPair = core.KeyPair
type LambdaDB = internaltheorydb.LambdaDB
func LambdaInit(models ...any) (*LambdaDB, error)
func NewLambdaOptimized() (*LambdaDB, error)
type LambdaMemoryStats = internaltheorydb.LambdaMemoryStats
type LambdaTimeoutConfig = internaltheorydb.LambdaTimeoutConfig
type MultiAccountDB = internaltheorydb.MultiAccountDB
func NewMultiAccount(accounts map[string]AccountConfig) (*MultiAccountDB, error)
type TypedExtendedDB = core.TypedExtendedDB
github.com/theory-cloud/tabletheory/v2/pkg/core
type AttributeMetadata struct{ ... }
type BatchChunkErrorHandler func(chunk []any, err error) error
type BatchDeleteResult struct{ ... }
type BatchGetBuilder interface{ ... }
type BatchGetOptions struct{ ... }
func DefaultBatchGetOptions() *BatchGetOptions
type BatchProgressCallback func(retrieved, total int)
type BatchWriteExecutor struct{ ... }
func NewBatchWriteExecutor(client *dynamodb.Client, ctx context.Context) *BatchWriteExecutor
type BatchWriteResult struct{ ... }
type CompiledQuery struct{ ... }
type ConsumedCapacity struct{ ... }
type DB interface{ ... }
type DynamoDBUpdateAPI interface{ ... }
type ExecutorWithBatchSupport struct{ ... }
func NewExecutorWithBatchSupport(client *dynamodb.Client, ctx context.Context) *ExecutorWithBatchSupport
type ExtendedDB interface{ ... }
type IndexSchema struct{ ... }
type KeyPair struct{ ... }
func NewKeyPair(partitionKey any, sortKey ...any) KeyPair
type KeySchema struct{ ... }
type ModelMetadata interface{ ... }
type PaginatedResult struct{ ... }
type Param struct{ ... }
type Query interface{ ... }
type RetryPolicy struct{ ... }
func DefaultRetryPolicy() *RetryPolicy
type TransactCondition struct{ ... }
type TransactConditionKind string
const TransactConditionKindField TransactConditionKind = "field" ...
type TransactGetRequest struct{ ... }
type TransactGetResult struct{ ... }
type TransactGetter interface{ ... }
type TransactionBuilder interface{ ... }
type TypedExtendedDB interface{ ... }
type UpdateBuilder interface{ ... }
type UpdateExecutor struct{ ... }
func NewUpdateExecutor(client DynamoDBUpdateAPI, ctx context.Context) *UpdateExecutor
type UpdateResult struct{ ... }
type WritePolicyProvider interface{ ... }
github.com/theory-cloud/tabletheory/v2/pkg/model
type FieldMetadata struct{ ... }
type IndexRole struct{ ... }
type IndexSchema struct{ ... }
type IndexType string
const GlobalSecondaryIndex IndexType = "GSI" ...
type KeySchema struct{ ... }
type Metadata struct{ ... }
type Registry struct{ ... }
func NewRegistry() *Registry
type WritePolicy struct{ ... }
func DefaultWritePolicy() WritePolicy
type WritePolicyMode string
const WritePolicyModeMutable WritePolicyMode = "mutable" ...
github.com/theory-cloud/tabletheory/v2/pkg/query
func Between(lo, hi any) []any
func EncodeCursor(lastKey map[string]types.AttributeValue, indexName string, ...) (string, error)
func FirstOrNil(q core.Query, dest any) (bool, error)
func NewUpdateBuilder(q *Query) core.UpdateBuilder
func UnmarshalItem(item map[string]types.AttributeValue, dest any) error
func UnmarshalItems(items []map[string]types.AttributeValue, dest any) error
type AggregateResult struct{ ... }
type AttributeValueConverter interface{ ... }
type BatchExecutor interface{ ... }
type BatchGetResult struct{ ... }
type BatchResult struct{ ... }
type BatchUpdateOptions struct{ ... }
func DefaultBatchOptions() *BatchUpdateOptions
type BatchWriteItemExecutor interface{ ... }
type CompiledBatchGet struct{ ... }
type CompiledBatchWrite struct{ ... }
type CompiledScan struct{ ... }
type Condition struct{ ... }
type CostEstimate struct{ ... }
type Cursor struct{ ... }
func DecodeCursor(encoded string) (*Cursor, error)
type DeleteItemExecutor interface{ ... }
type Filter struct{ ... }
type GetItemExecutor interface{ ... }
type GroupByQuery struct{ ... }
type GroupedResult struct{ ... }
type Operator string
const OpEqual Operator = "=" ...
const OpEQ Operator = "EQ" ...
type OptimizationOptions struct{ ... }
type OptimizedQuery struct{ ... }
type OrderBy struct{ ... }
type PaginatedQueryExecutor interface{ ... }
type PaginatedResult struct{ ... }
type PutItemExecutor interface{ ... }
type Query struct{ ... }
func New(model any, metadata core.ModelMetadata, executor QueryExecutor) *Query
func NewWithConditions(model any, metadata core.ModelMetadata, executor QueryExecutor, ...) *Query
type QueryCanceler struct{ ... }
type QueryExecutionResult struct{ ... }
type QueryExecutor interface{ ... }
type QueryOptimizer struct{ ... }
func NewOptimizer(opts *OptimizationOptions) *QueryOptimizer
type QueryPlan struct{ ... }
type QueryResult struct{ ... }
type QueryStatistics struct{ ... }
type RawFilter struct{ ... }
type RetryConfig struct{ ... }
type RetryPolicy = core.RetryPolicy
type ScanResult struct{ ... }
type UpdateBuilder struct{ ... }
type UpdateItemExecutor interface{ ... }
type UpdateItemWithResultExecutor interface{ ... }
github.com/theory-cloud/tabletheory/v2/pkg/session
type Config struct{ ... }
func DefaultConfig() *Config
type DynamoDBAPI interface{ ... }
type KMSClient interface{ ... }
type Session struct{ ... }
func NewSession(cfg *Config) (*Session, error)
func NewSessionWithClient(cfg *Config, client DynamoDBAPI) (*Session, error)
github.com/theory-cloud/tabletheory/v2/pkg/types
type Converter struct{ ... }
func NewConverter() *Converter
type CustomConverter interface{ ... }
github.com/theory-cloud/tabletheory/v2/pkg/marshal
func SetGlobalConfig(config Config)
func ValidateConfig(config Config) error
type Config struct{ ... }
func DefaultConfig() Config
func GetGlobalConfig() Config
type Marshaler struct{ ... }
func New(converter *pkgTypes.Converter) *Marshaler
type MarshalerFactory struct{ ... }
func NewMarshalerFactory(config Config) *MarshalerFactory
type MarshalerInterface interface{ ... }
type MarshalerType string
const SafeMarshalerType MarshalerType = "safe" ...
type SafeMarshaler struct{ ... }
func NewSafeMarshaler() *SafeMarshaler
func NewSafeMarshalerWithConverter(converter *pkgTypes.Converter) *SafeMarshaler
type SecurityAcknowledgment struct{ ... }
func CreateSecurityAcknowledgment(developerSignature string) *SecurityAcknowledgment
type SecurityStats struct{ ... }
func GetSecurityStats() SecurityStats
github.com/theory-cloud/tabletheory/v2/pkg/transaction
func TransactGet(ctx context.Context, sess *session.Session, registry *model.Registry, ...) ([]core.TransactGetResult, error)
type Builder struct{ ... }
func NewBuilder(sess *session.Session, registry *model.Registry, converter *pkgTypes.Converter) *Builder
type Transaction struct{ ... }
func NewTransaction(session *session.Session, registry *model.Registry, ...) *Transaction
github.com/theory-cloud/tabletheory/v2/pkg/errors
var ErrItemNotFound = errors.New("item not found") ...
func IsConditionFailed(err error) bool
func IsInvalidModel(err error) bool
func IsNotFound(err error) bool
type EncryptedFieldError struct{ ... }
type TheorydbError struct{ ... }
func NewError(op, model string, err error) *TheorydbError
func NewErrorWithContext(op, model string, err error, context map[string]any) *TheorydbError
type TransactionError struct{ ... }
github.com/theory-cloud/tabletheory/v2/pkg/mocks
func NewMockCreateTableOutput(tableName string) *dynamodb.CreateTableOutput
func NewMockDeleteTableOutput(tableName string) *dynamodb.DeleteTableOutput
func NewMockDescribeTableOutput(tableName string, status types.TableStatus) *dynamodb.DescribeTableOutput
func NewMockUpdateTimeToLiveOutput(tableName string) *dynamodb.UpdateTimeToLiveOutput
type BatchGetBuilder = MockBatchGetBuilder
type DB = MockDB
type DynamoDBClient = MockDynamoDBClient
type ExtendedDB = MockExtendedDB
type MockBatchGetBuilder struct{ ... }
type MockDB struct{ ... }
type MockDynamoDBClient struct{ ... }
type MockExtendedDB struct{ ... }
func NewMockExtendedDB() *MockExtendedDB
func NewMockExtendedDBStrict() *MockExtendedDB
type MockKMSClient struct{ ... }
type MockQuery struct{ ... }
type MockTableExistsWaiter struct{ ... }
type MockTableNotExistsWaiter struct{ ... }
type MockTransactionBuilder struct{ ... }
type MockUpdateBuilder struct{ ... }
type Query = MockQuery
type TableExistsWaiter = MockTableExistsWaiter
type TableNotExistsWaiter = MockTableNotExistsWaiter
type TransactionBuilder = MockTransactionBuilder
type UpdateBuilder = MockUpdateBuilder
type User struct{ ... }
type UserService struct{ ... }
func NewUserService(db core.DB) *UserService
github.com/theory-cloud/tabletheory/v2/pkg/typed
type Key[T any] struct{ ... }
func NewKey[T any](partitionKey any, sortKey ...any) Key[T]
type Model[T any] struct{ ... }
func ModelOf[T any](db core.DB) Model[T]
type Query[T any] struct{ ... }
github.com/theory-cloud/tabletheory/v2/pkg/testing
type CommonScenarios struct{ ... }
func NewCommonScenarios(db *TestDB) *CommonScenarios
type ConfigurableDBFactory interface{ ... }
type ConfigurableMockDBFactory struct{ ... }
func NewConfigurableMockDBFactory() *ConfigurableMockDBFactory
type DBFactory interface{ ... }
func SimpleMockFactory(setupFunc func(db *mocks.MockExtendedDB)) DBFactory
type DefaultDBFactory struct{}
type FactoryConfig struct{ ... }
type Middleware func(next Operation) Operation
type MockDBFactory struct{ ... }
func NewMockDBFactory() *MockDBFactory
type MockUpdateBuilder struct{ ... }
type Operation func() error
type QueryChain struct{ ... }
type TestDB struct{ ... }
func NewTestDB() *TestDB
type TestDBFactory struct{ ... }
github.com/theory-cloud/tabletheory/v2/pkg/testing/fakedb
type Fake struct{ ... }
func New() *Fake
github.com/theory-cloud/tabletheory/v2/pkg/schema
func TransformWithValidation(item map[string]types.AttributeValue, transform TransformFunc, ...) (map[string]types.AttributeValue, error)
type AutoMigrateOption func(*AutoMigrateOptions)
func WithBackupTable(tableName string) AutoMigrateOption
func WithBatchSize(size int) AutoMigrateOption
func WithContext(ctx context.Context) AutoMigrateOption
func WithDataCopy(enable bool) AutoMigrateOption
func WithTargetModel(model any) AutoMigrateOption
func WithTransform(transform interface{}) AutoMigrateOption
type AutoMigrateOptions struct{ ... }
type GSIUpdatePlan struct{ ... }
type Manager struct{ ... }
func NewManager(session *session.Session, registry *model.Registry) *Manager
type ModelTransformFunc interface{}
type TableOption func(*dynamodb.CreateTableInput)
func WithBillingMode(mode types.BillingMode) TableOption
func WithGSICreate(indexName string, partitionKey string, sortKey string, ...) TableOption
func WithGSIDelete(indexName string) TableOption
func WithSSESpecification(spec types.SSESpecification) TableOption
func WithStreamSpecification(spec types.StreamSpecification) TableOption
func WithThroughput(rcu, wcu int64) TableOption
type TransformFunc func(source map[string]types.AttributeValue) (map[string]types.AttributeValue, error)
func AddField(fieldName string, defaultValue types.AttributeValue) TransformFunc
func ChainTransforms(transforms ...TransformFunc) TransformFunc
func CopyAllFields() TransformFunc
func CreateModelTransform(transformFunc interface{}, sourceMetadata, targetMetadata *model.Metadata) (TransformFunc, error)
func RemoveField(fieldName string) TransformFunc
func RenameField(oldName, newName string) TransformFunc
type TransformValidator struct{ ... }
func NewTransformValidator(sourceMetadata, targetMetadata *model.Metadata) *TransformValidator
github.com/theory-cloud/tabletheory/v2/pkg/dms
func AssertModelsEquivalent(got, want Model, opts CompareOptions) error
func Generate(doc *Document, opts GenerateOptions) ([]byte, error)
type Attribute struct{ ... }
type CompareOptions struct{ ... }
type Document struct{ ... }
func ParseDocument(data []byte) (*Document, error)
type GenerateOptions struct{ ... }
type Index struct{ ... }
type KeyAttribute struct{ ... }
type Keys struct{ ... }
type Model struct{ ... }
func FindModel(doc *Document, name string) (*Model, bool)
func FromMetadata(meta *model.Metadata) (Model, error)
type Naming struct{ ... }
type Projection struct{ ... }
type Table struct{ ... }
type WritePolicy struct{ ... }