Documentation ¶
Index ¶
- func CreateTable(ctx context.Context, db *helper.DynamoDB, ...)
- func CreateTableSpending(ctx context.Context, db *helper.DynamoDB) error
- func CreateTableUser(ctx context.Context, db *helper.DynamoDB) error
- func DeleteTable(ctx context.Context, db *helper.DynamoDB) error
- func ListTables(ctx context.Context, db *helper.DynamoDB) []string
- func SetupClient(ctx context.Context) *dynamodb.Client
- func SetupDatabase(ctx context.Context) helper.DynamoDB
- func TableExists(ctx context.Context, db *helper.DynamoDB) bool
- type Router
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateTable ¶
func CreateTable(ctx context.Context, db *helper.DynamoDB, createTableFunc func(ctx2 context.Context, dynamoDB *helper.DynamoDB) error)
CreateTable creates new DynamoDB table using the specified creation function and the provided DynamoDB instance.
func CreateTableSpending ¶
CreateTableSpending creates a new DynamoDB table named `Spending` for storing user's spending data using the specified DynamoDB instance.
The `Spending` table has a hash key of `Id` and a Global Secondary Index (GSI) named `UserIndex` with a hash key of `UserId` and sort key of `Date`.
func CreateTableUser ¶
CreateTableUser creates a new DynamoDB table named `Users` for storing user data using the specified DynamoDB instance.
func DeleteTable ¶
DeleteTable deletes a DynamoDB table using the specified DynamoDB instance
func ListTables ¶
ListTables retrieves a list of table names from the specified DynamoDB instance.
func SetupClient ¶
SetupClient creates and returns a new DynamoDB client based on the default setup of AWS.
func SetupDatabase ¶
SetupDatabase sets up and returns a helper.DynamoDB instance with configured client and created tables for user data and spending data.
Types ¶
type Router ¶
type Router struct { // UserController represents the controller for user-related functionality. UserController controller.UserController // SpendingController represents the controller for user's spending-related functionality. SpendingController controller.SpendingController }
Router is a struct representing an HTTP router and associated controllers.
func (Router) NewRouter ¶
func (controller Router) NewRouter() *httprouter.Router
NewRouter creates and returns a new instance of httprouter.Router
The NewRouter function is used to define and handle routes based on the defined controller.