db

package
v0.0.0-...-e081fb4 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateItem

func CreateItem(productID string,
	productName string,
	quantity int,
	discount float64,
	price float64) map[string]*dynamodb.AttributeValue

func CreateItemPutPayload

func CreateItemPutPayload(item map[string]*dynamodb.AttributeValue, tableName string) *dynamodb.PutItemInput

Types

type DBManager

type DBManager struct {
	AwsSession          *session.Session
	DynamoServiceClient *dynamodb.DynamoDB
	DynamodbTable       string
}

func (*DBManager) CreateItemInDB

func (dbm *DBManager) CreateItemInDB(productItem ProductItem) error

func (*DBManager) DeleteProductWithID

func (dbm *DBManager) DeleteProductWithID(productID string) error

func (*DBManager) GetAllItemsInDB

func (dbm *DBManager) GetAllItemsInDB() ([]ProductItem, error)

func (*DBManager) GetProductWithID

func (dbm *DBManager) GetProductWithID(productID string) ([]ProductItem, error)

func (*DBManager) Init

func (dbm *DBManager) Init(cfg *aws.Config, tableName string)

type ProductItem

type ProductItem struct {
	ProductID string  `json:"ProductID"`
	Name      string  `json:"Name"`
	Quantity  int     `json:"Quantity"`
	Discount  float64 `json:"Discount"`
	Price     float64 `json:"Price"`
}

func CastDbRawItemToProductObject

func CastDbRawItemToProductObject(item map[string]*dynamodb.AttributeValue) ProductItem

func CastDbRawItemsListToProductObjectList

func CastDbRawItemsListToProductObjectList(items []map[string]*dynamodb.AttributeValue) []ProductItem

Jump to

Keyboard shortcuts

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