integration

package
v7.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2026 License: Apache-2.0 Imports: 16 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TestEndpoint

func TestEndpoint() string

TestEndpoint resolves the DynamoDB endpoint for integration tests. It keeps the historical localhost default while letting a caller run the suite against DynamoDB Local on another port through DYNAMODB_ENDPOINT.

Types

type TestAccount

type TestAccount struct {
	AccountID string `theorydb:"pk"`
	UserID    string `theorydb:"sk"`
	Type      string
	Balance   float64
	Version   int64 `theorydb:"version"`
}

type TestBlogPost

type TestBlogPost struct {
	PublishedAt time.Time
	CreatedAt   time.Time `theorydb:"created_at"`
	UpdatedAt   time.Time `theorydb:"updated_at"`
	PostID      string    `theorydb:"pk"`
	Title       string
	Content     string
	AuthorID    string   `theorydb:"index:gsi-author"`
	Tags        []string `theorydb:"set"`
}

type TestComment

type TestComment struct {
	CreatedAt time.Time `theorydb:"created_at"`
	CommentID string    `theorydb:"pk"`
	PostID    string    `theorydb:"sk"`
	AuthorID  string
	Content   string
}

type TestContact

type TestContact struct {
	ID      string `theorydb:"pk"`
	Name    string
	Email   string
	Phone   string
	Company string
	Active  bool
}

type TestContext

type TestContext struct {
	DB             core.ExtendedDB
	DynamoDBClient *dynamodb.Client
	TablesCreated  []string
	// contains filtered or unexported fields
}

TestContext holds test database and cleanup functions

func InitTestDB

func InitTestDB(t *testing.T) *TestContext

InitTestDB creates a test database instance with proper cleanup setup

func (*TestContext) AddCleanupFunc

func (tc *TestContext) AddCleanupFunc(cleanup func() error)

AddCleanupFunc adds a custom cleanup function

func (*TestContext) Cleanup

func (tc *TestContext) Cleanup() error

Cleanup performs all registered cleanup operations

func (*TestContext) ClearTableData

func (tc *TestContext) ClearTableData(t *testing.T, tableName string)

ClearTableData removes all items from a table

func (*TestContext) CreateTable

func (tc *TestContext) CreateTable(t *testing.T, model any)

CreateTable creates a table and registers it for cleanup

func (*TestContext) CreateTableIfNotExists

func (tc *TestContext) CreateTableIfNotExists(t *testing.T, model any)

CreateTableIfNotExists creates a table only if it doesn't exist

func (*TestContext) DeleteTable

func (tc *TestContext) DeleteTable(t *testing.T, tableName string)

DeleteTable deletes a table (alternative cleanup strategy)

func (*TestContext) WaitForTable

func (tc *TestContext) WaitForTable(t *testing.T, tableName string)

WaitForTable waits for a table to become active

type TestNote

type TestNote struct {
	CreatedAt time.Time `theorydb:"created_at"`
	UpdatedAt time.Time `theorydb:"updated_at"`
	ID        string    `theorydb:"pk"`
	Title     string
	Content   string
	Tags      []string
	Priority  int
	Archived  bool
}

type TestOrder

type TestOrder struct {
	CreatedAt  time.Time `theorydb:"created_at"`
	OrderID    string    `theorydb:"pk"`
	CustomerID string    `theorydb:"sk"`
	Status     string
	Amount     float64
}

type TestProduct

type TestProduct struct {
	UpdatedAt time.Time `theorydb:"updated_at"`
	ProductID string    `theorydb:"pk"`
	Name      string
	Category  string `theorydb:"index:gsi-category"`
	Price     float64
	InStock   bool
}

type TestUser

type TestUser struct {
	CreatedAt time.Time `theorydb:"created_at"`
	UpdatedAt time.Time `theorydb:"updated_at"`
	ID        string    `theorydb:"pk"`
	Email     string    `theorydb:"index:gsi-email"`
	Name      string
	Active    bool
}

Jump to

Keyboard shortcuts

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