Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewDynamoDBClient ¶
NewDynamoDBClient creates a new DynamoDB client.
func PutTransactions ¶
func PutTransactions(svc *dynamodb.DynamoDB, transactions []Transaction) error
PutTransactions uses BatchWriteItem to put multiple transactions into DynamoDB.
Types ¶
type Metrics ¶
type Metrics struct { Balance float64 `json:"balance"` PositiveAverage float64 `json:"positiveAverage"` NegativeAverage float64 `json:"negativeAverage"` TransactionsByMonth map[string]int `json:"transactionsByMonth"` Transactions []Transaction `json:"transactions"` }
Metrics represents the calculated metrics for transactions.
func CalculateMetrics ¶
func CalculateMetrics(transactions []Transaction) (Metrics, error)
type Transaction ¶
type Transaction struct { Email string `json:"email"` Amount float64 `json:"amount"` Month string `json:"month"` TransactionID string `json:"transactionId"` }
func QueryTransactionsByEmail ¶
func QueryTransactionsByEmail(svc dynamodbiface.DynamoDBAPI, email string) ([]Transaction, error)
QueryTransactionsByEmail queries DynamoDB for transactions by email.
func (*Transaction) GenerateTransactionID ¶
func (t *Transaction) GenerateTransactionID()
Click to show internal directories.
Click to hide internal directories.