ingridients

package
v0.0.0-...-b6ebf10 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Default

type Default struct {
	StorageOperator IngridientsOperator
}

func (*Default) All

func (d *Default) All(ctx context.Context) ([]Ingridient, error)

func (*Default) Find

func (d *Default) Find(ctx context.Context, search string, limit, last int) ([]Ingridient, error)

func (*Default) Random

func (d *Default) Random(ctx context.Context, limit int) ([]Ingridient, error)

type External

type External struct {
	URL string

	Client http.Client
}

func (*External) All

func (d *External) All(ctx context.Context) ([]Ingridient, error)

func (*External) Find

func (d *External) Find(ctx context.Context, search string, limit, last int) ([]Ingridient, error)

func (*External) Random

func (d *External) Random(ctx context.Context, limit int) ([]Ingridient, error)

type Functionality

type Functionality interface {
	All(ctx context.Context) ([]Ingridient, error)
	Random(ctx context.Context, limit int) ([]Ingridient, error)
	Find(ctx context.Context, search string, limit, last int) ([]Ingridient, error)
}

type Ingridient

type Ingridient struct {
	ID   int    `db:"id" json:"id"`
	Name string `db:"name" json:"name"`

	Calories   float32 `db:"calories" json:"calories"`
	Nutritions float32 `db:"nutritions" json:"nutritions"`
	Fats       float32 `db:"fats" json:"fats"`
	Carbs      float32 `db:"carbs" json:"carbs"`
	Water      float32 `db:"water" json:"water"`
	Fibers     float32 `db:"fibers" json:"fibers"`
}

func (Ingridient) String

func (i Ingridient) String() string

type IngridientsOperator

type IngridientsOperator interface {
	All(ctx context.Context) ([]Ingridient, error)
	Random(ctx context.Context, limit int) ([]Ingridient, error)
	Find(ctx context.Context, search string, limit, last int) (data []Ingridient, err error)
}

type InlineKeyboardPresenter

type InlineKeyboardPresenter struct {
	Model []Ingridient
}

func (InlineKeyboardPresenter) Keyboard

type Postgres

type Postgres struct {
	DB *sqlx.DB
}

func (*Postgres) All

func (p *Postgres) All(ctx context.Context) (data []Ingridient, err error)

func (*Postgres) Find

func (p *Postgres) Find(ctx context.Context, search string, limit int, last int) (data []Ingridient, err error)

func (*Postgres) Random

func (p *Postgres) Random(ctx context.Context, limit int) (data []Ingridient, err error)

type StringPresenter

type StringPresenter struct {
	Model []Ingridient
}

func (StringPresenter) String

func (ip StringPresenter) String() string

Jump to

Keyboard shortcuts

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