app

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: May 29, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package app provides business logic.

Package app is a generated GoMock package.

Index

Constants

View Source
const ServiceName = "example"

ServiceName provides name of this microservice for logs/metrics.

Variables

View Source
var (
	ErrAccessDenied = errors.New("access denied")
	ErrNotFound     = errors.New("not found")
)

Errors.

View Source
var (
	Metric def.Metrics // Common metrics used by all packages.

)

Functions

func InitMetrics

func InitMetrics(reg *prometheus.Registry)

InitMetrics must be called once before using this package. It registers and initializes metrics used by this package.

Types

type App

type App struct {
	// contains filtered or unexported fields
}

App implements interface Appl.

func New

func New(repo Repo, cfg Config) *App

New creates and returns new App.

func (*App) Example

func (a *App) Example(ctx Ctx, auth dom.Auth, userID dom.UserName) (*Example, error)

Example implements Appl interface.

func (*App) IncExample

func (a *App) IncExample(ctx Ctx, auth dom.Auth) error

IncExample implements Appl interface.

type Appl

type Appl interface {
	// Example returns ...
	// Errors: ErrAccessDenied, ErrNotFound.
	Example(Ctx, dom.Auth, dom.UserName) (*Example, error)
	// IncExample creates or increments ...
	// Errors: none.
	IncExample(Ctx, dom.Auth) error
}

Appl provides application features (use cases) service.

type Config

type Config struct{}

Config contains configuration for business-logic.

type Ctx

type Ctx = context.Context

Ctx is a synonym for convenience.

type Example

type Example struct {
	Counter int
	Mtime   time.Time
}

Example describes ...

type MockAppl

type MockAppl struct {
	// contains filtered or unexported fields
}

MockAppl is a mock of Appl interface.

func NewMockAppl

func NewMockAppl(ctrl *gomock.Controller) *MockAppl

NewMockAppl creates a new mock instance.

func (*MockAppl) EXPECT

func (m *MockAppl) EXPECT() *MockApplMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockAppl) Example

func (m *MockAppl) Example(arg0 Ctx, arg1 dom.Auth, arg2 dom.UserName) (*Example, error)

Example mocks base method.

func (*MockAppl) IncExample

func (m *MockAppl) IncExample(arg0 Ctx, arg1 dom.Auth) error

IncExample mocks base method.

type MockApplMockRecorder

type MockApplMockRecorder struct {
	// contains filtered or unexported fields
}

MockApplMockRecorder is the mock recorder for MockAppl.

func (*MockApplMockRecorder) Example

func (mr *MockApplMockRecorder) Example(arg0, arg1, arg2 interface{}) *gomock.Call

Example indicates an expected call of Example.

func (*MockApplMockRecorder) IncExample

func (mr *MockApplMockRecorder) IncExample(arg0, arg1 interface{}) *gomock.Call

IncExample indicates an expected call of IncExample.

type MockRepo

type MockRepo struct {
	// contains filtered or unexported fields
}

MockRepo is a mock of Repo interface.

func NewMockRepo

func NewMockRepo(ctrl *gomock.Controller) *MockRepo

NewMockRepo creates a new mock instance.

func (*MockRepo) EXPECT

func (m *MockRepo) EXPECT() *MockRepoMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockRepo) Example

func (m *MockRepo) Example(arg0 Ctx, arg1 dom.UserName) (*Example, error)

Example mocks base method.

func (*MockRepo) IncExample

func (m *MockRepo) IncExample(arg0 Ctx, arg1 dom.UserName) error

IncExample mocks base method.

type MockRepoMockRecorder

type MockRepoMockRecorder struct {
	// contains filtered or unexported fields
}

MockRepoMockRecorder is the mock recorder for MockRepo.

func (*MockRepoMockRecorder) Example

func (mr *MockRepoMockRecorder) Example(arg0, arg1 interface{}) *gomock.Call

Example indicates an expected call of Example.

func (*MockRepoMockRecorder) IncExample

func (mr *MockRepoMockRecorder) IncExample(arg0, arg1 interface{}) *gomock.Call

IncExample indicates an expected call of IncExample.

type Repo

type Repo interface {
	// Example returns ...
	// Errors: ErrNotFound.
	Example(Ctx, dom.UserName) (*Example, error)
	// IncExample creates or increments ...
	// Errors: none.
	IncExample(Ctx, dom.UserName) error
}

Repo provides data storage.

Jump to

Keyboard shortcuts

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