product

package
v0.0.0-...-a470c86 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterHandlers

func RegisterHandlers(r *echo.Group, service Service)

RegisterHandlers for product

Types

type ID

type ID struct {
	ID string `json:"id"`
}

type Repository

type Repository interface {
	// get product
	Get(ctx context.Context, id string) (prod product, err error)

	// create new product
	Create(ctx context.Context, req createRequest) (id string, err error)

	// update product
	Update(ctx context.Context, id string, req updateRequest) error

	// delete product
	Delete(ctx context.Context, id string) error
}

Repository db repository

func NewRepository

func NewRepository(mdb mongodb.Provider) Repository

NewRepository returns a new repostory

type Service

type Service interface {
	Get(ctx context.Context, id string) (pro product, err error)

	// create new product
	Create(ctx context.Context, req createRequest) (id string, err error)

	// update product
	Update(ctx context.Context, id string, req updateRequest) error

	// delete product
	Delete(ctx context.Context, id string) error
}

Service is cutomer service

func NewService

func NewService(repo Repository, logger logger.Provider) Service

NewService is to create new service

Jump to

Keyboard shortcuts

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