integration

package
v1.0.23 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2025 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TestAccount

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

type TestBlogPost

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

type TestComment

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

type TestContact

type TestContact struct {
	ID      string `dynamorm:"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 {
	ID        string `dynamorm:"pk"`
	Title     string
	Content   string
	Priority  int
	Archived  bool
	Tags      []string
	CreatedAt time.Time `dynamorm:"created_at"`
	UpdatedAt time.Time `dynamorm:"updated_at"`
}

type TestOrder

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

type TestProduct

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

type TestUser

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

Jump to

Keyboard shortcuts

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