models

package
v0.0.0-...-be81f65 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ISO4217List = []string{}/* 182 elements not displayed */

Functions

func ISO4217

func ISO4217(str string) bool

IsISO4217 checks if string is valid ISO currency code

func MyIsISO4217

func MyIsISO4217(value interface{}) error

Types

type Beer

type Beer struct {
	mgm.DefaultModel `bson:",inline"`
	ID               int64   `json:"id" bson:"id" example:"1"`
	Name             string  `json:"name" bson:"name" example:"Golden"`
	Brewery          string  `json:"brewery" bson:"brewery" example:"Kross"`
	Country          string  `json:"country" bson:"country" example:"Chile"`
	Price            float64 `json:"price" bson:"price" example:"10.5"`
	Currency         string  `json:"currency" bson:"currency" example:"EUR"`
}

Beer model mongodb

func NewBeer

func NewBeer(id int64, name, brewery, country, currency string, price float64) *Beer

NewBeer create beer entry

type BeerBox

type BeerBox struct {
	PriceTotal float64 `json:"price_total" bson:"price_total"`
}

BeerBox model

type BeerBoxPayload

type BeerBoxPayload struct {
	Currency string `json:"currency" bson:"currency" example:"EUR"`
	Quantity int64  `json:"quantity,omitempty" bson:"quantity" default:"6"`
}

BeerBoxPayload model

func (BeerBoxPayload) Validate

func (m BeerBoxPayload) Validate() error

Validate method

type BeerItem

type BeerItem struct {
	ID       int64   `json:"id" bson:"id" example:"1"`
	Name     string  `json:"name" bson:"name" example:"Golden"`
	Brewery  string  `json:"brewery" bson:"brewery" example:"Kross"`
	Country  string  `json:"country" bson:"country" example:"Chile"`
	Price    float64 `json:"price" bson:"price" example:"10.5"`
	Currency string  `json:"currency" bson:"currency" example:"EUR"`
}

BeerItem model

type BeerItemPayload

type BeerItemPayload struct {
	ID       int64   `json:"id" bson:"id" example:"1"`
	Name     string  `json:"name" bson:"name" example:"Golden"`
	Brewery  string  `json:"brewery" bson:"brewery" example:"Kross"`
	Country  string  `json:"country" bson:"country" example:"Chile"`
	Price    float64 `json:"price" bson:"price" example:"10.5"`
	Currency string  `json:"currency" bson:"currency" example:"EUR"`
}

BeerItemPayload model

func (BeerItemPayload) Validate

func (m BeerItemPayload) Validate() error

Validate method

Jump to

Keyboard shortcuts

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