productgrp

package
v0.0.0-...-c64bf0e Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package productgrp maintains the group of handlers for product access.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidID = errors.New("ID is not in its proper form")
)

Set of error variables for handling product group errors.

Functions

func Routes

func Routes(app *web.App, cfg Config)

Routes adds specific routes for this group.

Types

type AppNewProduct

type AppNewProduct struct {
	Name     string  `json:"name" validate:"required"`
	Cost     float64 `json:"cost" validate:"required,gte=0"`
	Quantity int     `json:"quantity" validate:"required,gte=1"`
}

AppNewProduct defines the data needed to add a new product.

func (AppNewProduct) Validate

func (app AppNewProduct) Validate() error

Validate checks the data in the model is considered clean.

type AppProduct

type AppProduct struct {
	ID          string  `json:"id"`
	UserID      string  `json:"userID"`
	Name        string  `json:"name"`
	Cost        float64 `json:"cost"`
	Quantity    int     `json:"quantity"`
	DateCreated string  `json:"dateCreated"`
	DateUpdated string  `json:"dateUpdated"`
}

AppProduct represents information about an individual product.

type AppUpdateProduct

type AppUpdateProduct struct {
	Name     *string  `json:"name"`
	Cost     *float64 `json:"cost" validate:"omitempty,gte=0"`
	Quantity *int     `json:"quantity" validate:"omitempty,gte=1"`
}

AppUpdateProduct defines the data needed to update a product.

func (AppUpdateProduct) Validate

func (app AppUpdateProduct) Validate() error

Validate checks the data in the model is considered clean.

type Config

type Config struct {
	Log      *logger.Logger
	Delegate *delegate.Delegate
	Auth     *auth.Auth
	DB       *sqlx.DB
}

Config contains all the mandatory systems required by handlers.

Jump to

Keyboard shortcuts

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