product

package
v0.0.0-...-c60e208 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package product contains product application services

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Product

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

Product represents product application service

func Initialize

func Initialize(db *pg.DB, rbac RBAC, sec Securer) *Product

Initialize initalizes Product application service with defaults

func New

func New(db *pg.DB, udb UDB, rbac RBAC, sec Securer) *Product

New creates new product application service

func (*Product) Create

func (u *Product) Create(c echo.Context, req model.Product) (*model.Product, error)

Create creates a new product account

func (*Product) Delete

func (u *Product) Delete(c echo.Context, id int) error

Delete deletes a product

func (*Product) List

func (u *Product) List(c echo.Context, p *model.Pagination, query []string) ([]model.Product, int, error)

List returns list of products

func (*Product) Update

func (u *Product) Update(c echo.Context, req model.UpdateReq) (*model.Product, error)

Update updates product's contact information

func (*Product) View

func (u *Product) View(c echo.Context, query []string) (*model.Product, error)

View returns single product

type RBAC

type RBAC interface {
}

RBAC represents role-based-access-control interface

type Securer

type Securer interface {
	Hash(string) string
}

Securer represents security interface

type Service

type Service interface {
	Create(echo.Context, model.Product) (*model.Product, error)
	List(echo.Context, *model.Pagination, []string) ([]model.Product, int, error)
	View(echo.Context, []string) (*model.Product, error)
	Delete(echo.Context, int) error
	Update(echo.Context, model.UpdateReq) (*model.Product, error)
}

Service represents product application interface

type UDB

type UDB interface {
	Create(orm.DB, model.Product) (*model.Product, error)
	View(orm.DB, *model.FilterQuery) (*model.Product, error)
	List(orm.DB, *model.FilterQuery, *model.Pagination) ([]model.Product, int, error)
	Update(orm.DB, *model.Product) error
	Delete(orm.DB, *model.Product) error
}

UDB represents product repository interface

Directories

Path Synopsis
platform

Jump to

Keyboard shortcuts

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