types

package
v0.0.0-...-344413b Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidDuration = errors.New("invalid duration")
View Source
var ErrInvalidURL = errors.New("invalid url")
View Source
var Meals = map[Meal]struct{}{
	MealBreakfast: {},
	MealLunch:     {},
	MealDinner:    {},
	MealSnack:     {},
}

Functions

This section is empty.

Types

type Duration

type Duration time.Duration

A Duration is a wrapper around time.Duration that provides JSON marshalling and unmarshalling.

func (Duration) Into

func (d Duration) Into() time.Duration

func (Duration) MarshalJSON

func (d Duration) MarshalJSON() ([]byte, error)

func (*Duration) Scan

func (d *Duration) Scan(raw interface{}) error

func (*Duration) UnmarshalJSON

func (d *Duration) UnmarshalJSON(b []byte) error

func (Duration) Value

func (d Duration) Value() (driver.Value, error)

type Meal

type Meal string
const (
	MealBreakfast Meal = "breakfast"
	MealLunch     Meal = "lunch"
	MealDinner    Meal = "dinner"
	MealSnack     Meal = "snack"
)

type Recipe

type Recipe struct {
	ID           uuid.UUID `json:"id"`
	Name         string    `json:"name"`
	Cook         Duration  `json:"cook_duration" db:"cook_duration"`
	Instructions string    `json:"instructions"`
	ImageURL     URL       `json:"image_url" db:"image_url"`
	Meal         Meal      `json:"meal"`
}

type URL

type URL url.URL

A URL is a wrapper around url.URL that provides JSON marshalling and unmarshalling.

func (URL) Into

func (u URL) Into() url.URL

func (URL) MarshalJSON

func (u URL) MarshalJSON() ([]byte, error)

func (*URL) Scan

func (u *URL) Scan(raw interface{}) error

func (*URL) UnmarshalJSON

func (u *URL) UnmarshalJSON(data []byte) error

func (URL) Value

func (u URL) Value() (driver.Value, error)

Jump to

Keyboard shortcuts

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