dba

package
v0.0.0-...-701c789 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const OrderIdIndex = "OrderIdGsi"

Variables

View Source
var (
	ListAssetsNotFound = "4AC6E407-1D8E-4339-BA1C-862ACC58AC5E"
	ListAssetsFound    = "20032259-738B-40A7-AAD7-306B69AF88D4"
	GetAssetNotFound   = "E6096F2D-C706-42B6-B0E5-D7DD644ED079"
	GetAsset           = "AC032259-738B-40A7-AAD7-306B69AAB909"
	ListOrders         = "9165BBBF-02B8-408C-8345-04C34D8C1594"
	ListOrdersNotFound = "8FE47FE3-3B80-44EF-AEBF-DE9A1DF7491E"
)

Functions

func NewDBA

func NewDBA(r *DynamoRepository)

NewDBA sets the repository for the handlers

func NewTestDBA

func NewTestDBA(r *MockRepository)

Types

type DynamoRepository

type DynamoRepository struct {
	App *config.AppConfig
	Svc *dynamodb.Client
}

Repository is the repository type

var Repo *DynamoRepository

Repo the repository used by dynamo

func NewRepo

NewRepo creates a new repository

func (*DynamoRepository) GetAsset

func (m *DynamoRepository) GetAsset(ctx context.Context, requestUserId, assetId string) (model.Asset, error)

func (*DynamoRepository) ListAssets

func (m *DynamoRepository) ListAssets(ctx context.Context, requestUserId string) ([]model.Asset, error)

func (*DynamoRepository) ListOrders

func (m *DynamoRepository) ListOrders(ctx context.Context, userId string) ([]model.Order, error)

type MockRepository

type MockRepository struct {
	App *config.AppConfig
	Svc *dynamodb.Client
}
var TestRepo *MockRepository

func (*MockRepository) GetAsset

func (m *MockRepository) GetAsset(ctx context.Context, requestUserId, assetId string) (model.Asset, error)

func (*MockRepository) ListAssets

func (m *MockRepository) ListAssets(ctx context.Context, requestUserId string) ([]model.Asset, error)

func (*MockRepository) ListOrders

func (m *MockRepository) ListOrders(ctx context.Context, userId string) ([]model.Order, error)

type Repository

type Repository interface {
	ListOrders(ctx context.Context, userId string) ([]model.Order, error)
	ListAssets(ctx context.Context, requestUserId string) ([]model.Asset, error)
	GetAsset(ctx context.Context, requestUserId, assetId string) (model.Asset, error)
}

Jump to

Keyboard shortcuts

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