models

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMissingNameOrNames = errors.New("'name' or 'names' must be provided")
	ErrNameOrNames        = errors.New("'name' is mutually exclusive with 'names'")
	ErrNamesArePair       = errors.New("'names' must have two elements")
	ErrInvalidEventType   = errors.New("invalid event type")
)

Validation errors

View Source
var EventTypes = []EventType{Birthday, Nameday, Wedding}

Functions

This section is empty.

Types

type Event

type Event struct {
	Name    string     `yaml:"name,omitempty"`
	Names   *[2]string `yaml:"names,omitempty"`
	Surname string     `yaml:"surname,omitempty"`
	Type    EventType  `yaml:"type"`
	Month   time.Month `yaml:"-"`
	Day     int        `yaml:"-"`
}

func (Event) Format

func (e Event) Format(list bool) string

func (Event) Validate

func (e Event) Validate() error

type EventType

type EventType string
const (
	Birthday EventType = "birthday"
	Nameday  EventType = "nameday"
	Wedding  EventType = "wedding anniversary"
)

func (EventType) Format

func (et EventType) Format(accusative bool) string

func (EventType) String

func (et EventType) String() string

func (EventType) Validate

func (et EventType) Validate() error

type Events

type Events []Event

func (Events) String

func (ev Events) String() string

Jump to

Keyboard shortcuts

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