views

package
v0.0.0-...-dfdfd72 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// StoredBottleCollectionMap is a map indexing the attribute names of
	// StoredBottleCollection by view name.
	StoredBottleCollectionMap = map[string][]string{
		"default": {
			"id",
			"name",
			"winery",
			"vintage",
			"composition",
			"description",
			"rating",
		},
		"tiny": {
			"id",
			"name",
			"winery",
		},
	}
	// StoredBottleMap is a map indexing the attribute names of StoredBottle by
	// view name.
	StoredBottleMap = map[string][]string{
		"default": {
			"id",
			"name",
			"winery",
			"vintage",
			"composition",
			"description",
			"rating",
		},
		"tiny": {
			"id",
			"name",
			"winery",
		},
	}
	// WineryMap is a map indexing the attribute names of Winery by view name.
	WineryMap = map[string][]string{
		"default": {
			"name",
			"region",
			"country",
			"url",
		},
		"tiny": {
			"name",
		},
	}
)

Functions

func ValidateComponentView

func ValidateComponentView(result *ComponentView) (err error)

ValidateComponentView runs the validations defined on ComponentView.

func ValidateStoredBottle

func ValidateStoredBottle(result *StoredBottle) (err error)

ValidateStoredBottle runs the validations defined on the viewed result type StoredBottle.

func ValidateStoredBottleCollection

func ValidateStoredBottleCollection(result StoredBottleCollection) (err error)

ValidateStoredBottleCollection runs the validations defined on the viewed result type StoredBottleCollection.

func ValidateStoredBottleCollectionView

func ValidateStoredBottleCollectionView(result StoredBottleCollectionView) (err error)

ValidateStoredBottleCollectionView runs the validations defined on StoredBottleCollectionView using the "default" view.

func ValidateStoredBottleCollectionViewTiny

func ValidateStoredBottleCollectionViewTiny(result StoredBottleCollectionView) (err error)

ValidateStoredBottleCollectionViewTiny runs the validations defined on StoredBottleCollectionView using the "tiny" view.

func ValidateStoredBottleView

func ValidateStoredBottleView(result *StoredBottleView) (err error)

ValidateStoredBottleView runs the validations defined on StoredBottleView using the "default" view.

func ValidateStoredBottleViewTiny

func ValidateStoredBottleViewTiny(result *StoredBottleView) (err error)

ValidateStoredBottleViewTiny runs the validations defined on StoredBottleView using the "tiny" view.

func ValidateWineryView

func ValidateWineryView(result *WineryView) (err error)

ValidateWineryView runs the validations defined on WineryView using the "default" view.

func ValidateWineryViewTiny

func ValidateWineryViewTiny(result *WineryView) (err error)

ValidateWineryViewTiny runs the validations defined on WineryView using the "tiny" view.

Types

type ComponentView

type ComponentView struct {
	// Grape varietal
	Varietal *string
	// Percentage of varietal in wine
	Percentage *uint32
}

ComponentView is a type that runs validations on a projected type.

type StoredBottle

type StoredBottle struct {
	// Type to project
	Projected *StoredBottleView
	// View to render
	View string
}

StoredBottle is the viewed result type that is projected based on a view.

type StoredBottleCollection

type StoredBottleCollection struct {
	// Type to project
	Projected StoredBottleCollectionView
	// View to render
	View string
}

StoredBottleCollection is the viewed result type that is projected based on a view.

type StoredBottleCollectionView

type StoredBottleCollectionView []*StoredBottleView

StoredBottleCollectionView is a type that runs validations on a projected type.

type StoredBottleView

type StoredBottleView struct {
	// ID is the unique id of the bottle.
	ID *string
	// Name of bottle
	Name *string
	// Winery that produces wine
	Winery *WineryView
	// Vintage of bottle
	Vintage *uint32
	// Composition is the list of grape varietals and associated percentage.
	Composition []*ComponentView
	// Description of bottle
	Description *string
	// Rating of bottle from 1 (worst) to 5 (best)
	Rating *uint32
}

StoredBottleView is a type that runs validations on a projected type.

type WineryView

type WineryView struct {
	// Name of winery
	Name *string
	// Region of winery
	Region *string
	// Country of winery
	Country *string
	// Winery website URL
	URL *string
}

WineryView is a type that runs validations on a projected type.

Jump to

Keyboard shortcuts

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