core

package
v0.0.0-...-788e818 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SourceTypeBook   = "book"
	SourceTypeUrl    = "url"
	SourceTypeCustom = "custom"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Recipe

type Recipe struct {
	ID               primitive.ObjectID `bson:"_id,omitempty"`
	Title            string             `bson:"title,omitempty"`
	Source           primitive.ObjectID `bson:"source,omitempty"`
	SourceAnnotation string             `bson:"sourceAnnotation,omitempty"`
	Category         string             `bson:"category,omitempty"`
	Allergens        []string           `bson:"allergens,omitempty"`
}

type RecipeIDNotValidError

type RecipeIDNotValidError struct {
	ID string
}

func (*RecipeIDNotValidError) Error

func (err *RecipeIDNotValidError) Error() string

type RecipeNotFoundError

type RecipeNotFoundError struct {
	ID string
}

func (*RecipeNotFoundError) Error

func (err *RecipeNotFoundError) Error() string

type RecipeRepository

type RecipeRepository interface {
	GetRecipes(ctx context.Context) ([]Recipe, error)
	GetRecipeByID(ctx context.Context, id string) (Recipe, error)
	AddRecipe(ctx context.Context, recipe *Recipe) error
	UpdateRecipe(ctx context.Context, recipe Recipe) error
	DeleteRecipe(ctx context.Context, recipe Recipe) error
}

type Source

type Source struct {
	ID    primitive.ObjectID `bson:"_id,omitempty"`
	Type  sourceType         `bson:"type,omitempty"`
	Title string             `bson:"title,omitempty"`
}

type SourceIDNotValidError

type SourceIDNotValidError struct {
	ID string
}

func (*SourceIDNotValidError) Error

func (err *SourceIDNotValidError) Error() string

type SourceNotFoundError

type SourceNotFoundError struct {
	ID string
}

func (*SourceNotFoundError) Error

func (err *SourceNotFoundError) Error() string

type SourceRepository

type SourceRepository interface {
	GetSources(ctx context.Context) ([]Source, error)
	GetSourceByID(ctx context.Context, id string) (Source, error)
	AddSource(ctx context.Context, source *Source) error
	UpdateSource(ctx context.Context, source Source) error
	DeleteSource(ctx context.Context, source Source) error
}

type SourceTypeNotValidError

type SourceTypeNotValidError struct {
	SourceType sourceType
}

func (*SourceTypeNotValidError) Error

func (err *SourceTypeNotValidError) Error() string

Jump to

Keyboard shortcuts

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