paprika

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2021 License: Apache-2.0 Imports: 16 Imported by: 0

README

paprika-go

A simple go library for creating and managing your paprika recipes.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Collection

type Collection struct {
	// contains filtered or unexported fields
}

func LoadCollection

func LoadCollection(file string) (*Collection, error)

func NewCollection

func NewCollection() *Collection

func (*Collection) Add

func (c *Collection) Add(r ...Recipe)

func (*Collection) Export

func (c *Collection) Export(dest string) error

func (*Collection) Get

func (c *Collection) Get(rm ...RecipeMatcher)

func (*Collection) LoadRecipes

func (c *Collection) LoadRecipes(file ...string) error

func (*Collection) Remove

func (c *Collection) Remove(rs ...Recipe)

type Recipe

type Recipe struct {
	UID             string   `json:"uid"`
	Created         string   `json:"created"`
	Hash            string   `json:"hash"`
	Name            string   `json:"name"`
	Description     string   `json:"description"`
	Ingredients     string   `json:"ingredients"`
	Directions      string   `json:"directions"`
	Notes           string   `json:"notes"`
	NutritionalInfo string   `json:"nutritional_info"`
	PrepTime        string   `json:"prep_time"`
	CookTime        string   `json:"cook_time"`
	TotalTime       string   `json:"total_time"`
	Difficulty      string   `json:"difficulty"`
	Servings        string   `json:"servings"`
	Rating          int      `json:"rating"`
	Source          string   `json:"source"`
	SourceURL       string   `json:"source_url"`
	Photo           string   `json:"photo"`
	PhotoLarge      string   `json:"photo_large"`
	PhotoHash       string   `json:"photo_hash"`
	ImageURL        string   `json:"image_url"`
	Categories      []string `json:"categories"`
	PhotoData       string   `json:"photo_data"`
}

func NewRecipe

func NewRecipe(name, ingredients, directions string) *Recipe

NewRecipe creates a valid paprika recipe

func (*Recipe) SetImage

func (r *Recipe) SetImage(path string) error

SetImage sets the recipe image from a local image file

func (*Recipe) SetImageURL

func (r *Recipe) SetImageURL(url string) error

SetImageURL sets the recipe image from an image URL

type RecipeMatcher

type RecipeMatcher func(*Recipe) bool

func HasCategory

func HasCategory(category string) RecipeMatcher

func HasIngredient

func HasIngredient(ingredient string) RecipeMatcher

func NameContains

func NameContains(name string) RecipeMatcher

Jump to

Keyboard shortcuts

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