menu

package
v0.0.0-...-208db83 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Today

func Today(day *Day) bool

Today is a function that can be used to run FilterDay with to filter today's day in the menu.

Types

type Course

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

Course defines a meal type with a description.

func NewCourse

func NewCourse(t, d string) *Course

NewCourse creates a new course.

func (*Course) String

func (course *Course) String() string

String returns a string representation of this course.

type Day

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

Day represents the part of a menu on a particular da.

func EmptyDay

func EmptyDay() *Day

func NewDay

func NewDay(wd string, courses ...*Course) *Day

NewDay creates a new day.

func (*Day) AddCourse

func (day *Day) AddCourse(c *Course)

func (*Day) Copy

func (day *Day) Copy() *Day

Copy returns the name of this day.

func (*Day) SetWeekday

func (day *Day) SetWeekday(s string)

func (*Day) Today

func (day *Day) Today() bool

Today returns true if this day is todays date.

func (*Day) Translate

func (day *Day) Translate() string

Translate this days name to english.

func (*Day) Weekday

func (day *Day) Weekday() string

Weekday returns the name of this day.

type Menu struct {
	Days []*Day
	// contains filtered or unexported fields
}

GetMenu is the complete collection of courses over a week.

func NewMenu

func NewMenu(name string, days ...*Day) *Menu

NewMenu constructs a menu consisting of the given days.

func (menu *Menu) Count() int

Count returns the number of days in this menu.

func (menu *Menu) FilterDay(pred func(*Day) bool)

FilterDay runs the predicate for each day in the menu and keeps only those that returns true on the predicate function.

func (menu *Menu) Name() string
func (menu *Menu) Render()

Render the menu to its output.

func (menu *Menu) SetOutput(o io.Writer)

SetOutput changes the default output of os.Stdout to o instead.

Jump to

Keyboard shortcuts

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