app

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

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

func CreateTableSpending(ctx context.Context, db *helper.DynamoDB) error

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

func CreateTableUser(ctx context.Context, db *helper.DynamoDB) error

CreateTableUser creates a new DynamoDB table named `Users` for storing user data using the specified DynamoDB instance.

func DeleteTable

func DeleteTable(ctx context.Context, db *helper.DynamoDB) error

DeleteTable deletes a DynamoDB table using the specified DynamoDB instance

func ListTables

func ListTables(ctx context.Context, db *helper.DynamoDB) []string

ListTables retrieves a list of table names from the specified DynamoDB instance.

func SetupClient

func SetupClient(ctx context.Context) *dynamodb.Client

SetupClient creates and returns a new DynamoDB client based on the default setup of AWS.

func SetupDatabase

func SetupDatabase(ctx context.Context) helper.DynamoDB

SetupDatabase sets up and returns a helper.DynamoDB instance with configured client and created tables for user data and spending data.

func TableExists

func TableExists(ctx context.Context, db *helper.DynamoDB) bool

TableExists checks whether a DynamoDB table exists in the specified DynamoDB instance.

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.

Jump to

Keyboard shortcuts

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