api

package
v0.0.0-...-f8df05e Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2022 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package api containing API initialization and API route handler

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	DB       *sql.DB
	FiberApp *fiber.App
}

API contain database connection and router GoFiber for product service API

func (*API) AddProductHandler

func (a *API) AddProductHandler(c *fiber.Ctx) error

AddProductHandler handling route add product (method: POST, user: seller)

func (*API) DecreaseStockHandler

func (a *API) DecreaseStockHandler(c *fiber.Ctx) error

DecreaseStockHandler handling route decrease product stock (method: PUT, user: seller)

func (*API) DeleteProductHandler

func (a *API) DeleteProductHandler(c *fiber.Ctx) error

DeleteProductHandler handling route delete product (method: DELETE, user: seller)

func (*API) GetProductHandler

func (a *API) GetProductHandler(c *fiber.Ctx) error

GetProductHandler handling route get one product by SKU (method: GET, user: all)

func (*API) GetProductsByUserIDHandler

func (a *API) GetProductsByUserIDHandler(c *fiber.Ctx) error

GetProductsByUserIDHandler handling route get products by user ID (method: GET, user: seller)

func (*API) GetProductsHandler

func (a *API) GetProductsHandler(c *fiber.Ctx) error

GetProductsHandler handling route get products (method: GET, user: buyer)

func (*API) InitDB

func (a *API) InitDB(DBConfig map[string]string) error

InitDB initialize API database connection

func (*API) InitRouter

func (a *API) InitRouter()

InitRouter initialize GoFiber router for API

func (*API) UpdateProductHandler

func (a *API) UpdateProductHandler(c *fiber.Ctx) error

UpdateProductHandler handling route update product (method: PUT, user: seller)

Jump to

Keyboard shortcuts

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