helpers

package
v0.0.0-...-19ba2dd Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	CartIsEmptyError             = errors.New("your cart is empty")
	InvalidIdError               = errors.New("invalid id")
	IdIsRequiredError            = errors.New("id is required")
	UserNotFoundError            = errors.New("user not found")
	UserExistsError              = errors.New("user already exists")
	InvalidPasswordError         = errors.New("wrong password")
	UnAuthorizedError            = errors.New("you are not authorized to access this resource")
	ProductNotFoundError         = errors.New("product not found")
	ProductNotFoundErrorInCart   = errors.New("product not found in cart")
	ProductNotEnoughStockError   = errors.New("product not enough stock")
	UnsupportedMediaType         = errors.New("Content-Type header is not application/json")
	InvalidNumberOfProductsError = errors.New("invalid number of products")
	ProductAlreadyExistError     = errors.New("product already exist")
	ProductAlreadyExistInCart    = errors.New("product already exist in cart")
	CategoryNotFoundError        = errors.New("category not found")
	CategoryAlreadyExistError    = errors.New("category already exist")
	InvalidStockError            = errors.New("invalid stock")
	SkuAlreadyExistError         = errors.New("there is already a product with this sku")
	SkuIsSameError               = errors.New("sku is same")
	InvalidPriceError            = errors.New("price should be greater than 0 and numeric")
	NameIsSameError              = errors.New("name is same")
	NameAlreadyExistError        = errors.New("there is another product with the same name")
	NotEnoughStockError          = errors.New("there is not enough stock for this product")
	OrderNotFoundError           = errors.New("order not found")
	OrderCancelError             = errors.New("order can't be canceled after 14 days")
	InvalidFieldError            = errors.New("invalid field")
	FileError                    = errors.New("file's type is not supported or file is not uploaded")
	CsvFileError                 = errors.New("csv file is not valid")
	CsvFileEmptyError            = errors.New("csv file is empty")
	CsvCouldNotOpenFileError     = errors.New("could not open csv file")
	CsvColumnsError              = errors.New("csv file should have the following column: name")
	SearchParamRequireError      = errors.New("search parameter is required")
	PageCouldNotBeFoundError     = errors.New("page could not be found")
)

Functions

func DecodeBody

func DecodeBody(body interface{}, context *gin.Context) error

func ReadCsv

func ReadCsv(filePath string) ([]string, error)

Types

type ApiError

type ApiError struct {
	Field string
	Msg   string
}

Jump to

Keyboard shortcuts

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