service

package
v0.0.0-...-cdffa6e Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2022 License: MIT Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCatalogId

func NewCatalogId() int64

func NewHandler

func NewHandler(router *gin.Engine)

register route and init handler

func NewServer

func NewServer() *gin.Engine

Types

type Catalog

type Catalog struct {
	Id              int64
	SKU             string `form:"sku" binding:"required"`
	ShipsWithin     int    `form:"shipswithin" binding:"required"`
	QuantityInStock int    `form:"stock" binding:"required"`
}

type Controller

type Controller struct {
	DB *mongo.Client
}

func NewController

func NewController() *Controller

func (*Controller) Create

func (c *Controller) Create(ctx *gin.Context) (res *Catalog, err error)

func (*Controller) Get

func (c *Controller) Get(ctx *gin.Context) (res *Catalog, err error)

func (*Controller) GetBySku

func (c *Controller) GetBySku(ctx *gin.Context, sku string) (*Catalog, error)

type Handler

type Handler struct {
	Controller *Controller
}

func (*Handler) Create

func (h *Handler) Create(ctx *gin.Context)

func (*Handler) Get

func (h *Handler) Get(ctx *gin.Context)

Jump to

Keyboard shortcuts

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