repository

package
v0.0.0-...-5552a58 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Code generated by mockery v1.0.0. DO NOT EDIT.

Code generated by mockery v1.0.0. DO NOT EDIT.

Index

Constants

View Source
const (
	// MemoryDatabase value can be used to start the service using an in-memory DB. See Service/DbType.
	MemoryDatabase = "memory"
	// SQLServerDriverName value can be used to start the service using an external MsSql DB. See Service/DbType.
	SQLServerDriverName = "mssql"
)

Variables

View Source
var ErrDuplicateKey = errors.New("Duplicate key")

ErrDuplicateKey is thrown when there is an attempt to create an order with an OrderId which already is used.

Functions

This section is empty.

Types

type MockOrderRepository

type MockOrderRepository struct {
	mock.Mock
}

MockOrderRepository is an autogenerated mock type for the OrderRepository type

func (*MockOrderRepository) DeleteNamespaceOrders

func (_m *MockOrderRepository) DeleteNamespaceOrders(ns string) error

DeleteNamespaceOrders provides a mock function with given fields: ns

func (*MockOrderRepository) DeleteOrders

func (_m *MockOrderRepository) DeleteOrders() error

DeleteOrders provides a mock function with given fields:

func (*MockOrderRepository) GetNamespaceOrders

func (_m *MockOrderRepository) GetNamespaceOrders(ns string) ([]Order, error)

GetNamespaceOrders provides a mock function with given fields: ns

func (*MockOrderRepository) GetOrders

func (_m *MockOrderRepository) GetOrders() ([]Order, error)

GetOrders provides a mock function with given fields:

func (*MockOrderRepository) InsertOrder

func (_m *MockOrderRepository) InsertOrder(o Order) error

InsertOrder provides a mock function with given fields: o

type Order

type Order struct {
	OrderId   string  `json:"orderId"`
	Namespace string  `json:"namespace"`
	Total     float64 `json:"total"`
}

Order contains the details of an order entity.

type OrderCreatedEvent

type OrderCreatedEvent struct {
	OrderCode string `json:"orderCode"`
}

type OrderRepository

type OrderRepository interface {
	InsertOrder(o Order) error
	GetOrders() ([]Order, error)
	GetNamespaceOrders(ns string) ([]Order, error)
	DeleteOrders() error
	DeleteNamespaceOrders(ns string) error
	// contains filtered or unexported methods
}

OrderRepository interface defines the basic operations needed for the order service

func Create

func Create(dbtype string) (OrderRepository, error)

Create is used to create an OrderRepository based on the given dbtype. Currently the `MemoryDatabase` and `SQLServerDriverName` are supported.

func NewOrderRepositoryDb

func NewOrderRepositoryDb() (OrderRepository, error)

NewOrderRepositoryDb is used to instantiate and return the DB implementation of the OrderRepository. The connection to the database is created by initiating the configuration defined in https://github.com/kyma-project/examples/blob/main/http-db-service/internal/mssqldb/config.go

func NewOrderRepositoryMemory

func NewOrderRepositoryMemory() OrderRepository

NewOrderRepositoryMemory is used to instantiate and return the DB implementation of the OrderRepository.

Jump to

Keyboard shortcuts

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