account

package
v0.0.0-...-f5b340a Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// UpdateError update error
	UpdateError errors.TraceableType = "AccountUpdateError"
	// GetError when account cannot be retrieved
	GetError errors.TraceableType = "AccountGetError"
	// CreationError is thrown when creation of the account is not satisfactory
	CreationError errors.TraceableType = "AccountCreationError"
	// DeleteError when account cannot be retrieved
	DeleteError errors.TraceableType = "AccountDeleteError"
	// ListError when account cannot be found
	ListError errors.TraceableType = "AccountDeleteError"
)

Variables

This section is empty.

Functions

func CreateEP

func CreateEP(svc Service) endpoint.Endpoint

func DeleteEP

func DeleteEP(svc Service) endpoint.Endpoint

func GetEP

func GetEP(svc Service) endpoint.Endpoint

func UpdateEP

func UpdateEP(svc Service) endpoint.Endpoint

Types

type Account

type Account struct {
	ID   t.String
	Name t.String
}

Account represents the account information

type AccountCursorList

type AccountCursorList struct {
	LastKey t.String
	Results []*Account
}

type Repository

type Repository interface {
	Create(c context.Context, id t.String, data *Account) error
	Get(c context.Context, id t.String) (*Account, error)
	Update(c context.Context, id t.String, data *Account) error
	FindAll(c context.Context, startAt string, limit int64) (*AccountCursorList, error)
	Delete(c context.Context, id t.String) error
}

AccountRepository is the interface to store the data (it will need to be implemented)

type Service

type Service interface {
	Create(c context.Context, data *Account) (t.String, error)
	Get(c context.Context, accountID t.String) (*Account, error)
	Update(c context.Context, accountID t.String, data *Account) error
	Delete(c context.Context, accountID t.String) error
	List(c context.Context, startAt string, limit int64) (*AccountCursorList, error)
}

Service is the inteface that exposes the services

func New

func New(accounts Repository) Service

New creates a new instance of the service

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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