batch

package
v0.0.0-...-fb90bc2 Latest Latest
Warning

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

Go to latest
Published: May 30, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Batch

type Batch struct {
	Id               uuid.UUID         `json:"id"`
	Name             string            `json:"name"`
	CacaoPercentage  float32           `json:"cacao_percentage"`
	Output           int               `json:"output"`
	Ingredients      []BatchIngredient `json:"ingredients"`
	History          []BatchEvent      `json:"history"`
	Notes            string            `json:"notes"`
	AptForProduction bool              `json:"apt_for_production"`
}

func NewBatch

func NewBatch(name string) Batch

func (*Batch) AddIngredient

func (b *Batch) AddIngredient(i BatchIngredient)

func (*Batch) AddNotes

func (b *Batch) AddNotes(notes string)

func (*Batch) MarkAptForProduction

func (b *Batch) MarkAptForProduction()

func (*Batch) RemoveAptForProduction

func (b *Batch) RemoveAptForProduction()

func (*Batch) Stop

func (b *Batch) Stop()

type BatchEvent

type BatchEvent struct {
	Ts      time.Time `json:"ts"`
	Action  string    `json:"action"`
	Message string    `json:"message"`
}

type BatchIngredient

type BatchIngredient struct {
	Name    string `json:"name"`
	Qty     int    `json:"qty"`
	IsCacao bool   `json:"is_cacao"`
}

type PostgreSQLGORMRepository

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

func NewPostgreSQLGORMRepository

func NewPostgreSQLGORMRepository(db *gorm.DB) *PostgreSQLGORMRepository

func (*PostgreSQLGORMRepository) Create

func (r *PostgreSQLGORMRepository) Create(ctx context.Context, batch Batch) (*Batch, error)

func (*PostgreSQLGORMRepository) DeleteByID

func (r *PostgreSQLGORMRepository) DeleteByID(ctx context.Context, id uuid.UUID) error

func (*PostgreSQLGORMRepository) GetByID

func (r *PostgreSQLGORMRepository) GetByID(ctx context.Context, id uuid.UUID) (*Batch, error)

func (*PostgreSQLGORMRepository) GetByName

func (r *PostgreSQLGORMRepository) GetByName(ctx context.Context, name string) (*Batch, error)

func (*PostgreSQLGORMRepository) List

func (*PostgreSQLGORMRepository) Migrate

func (*PostgreSQLGORMRepository) Update

func (r *PostgreSQLGORMRepository) Update(ctx context.Context, batch Batch) (*Batch, error)

type Repository

type Repository interface {
	Migrate(ctx context.Context) error
	Create(ctx context.Context, batch Batch) (*Batch, error)
	List(ctx context.Context) ([]Batch, error)
	GetByID(ctx context.Context, id uuid.UUID) (*Batch, error)
	GetByName(ctx context.Context, name string) (*Batch, error)
	Update(ctx context.Context, batch Batch) (*Batch, error)
	DeleteByID(ctx context.Context, id uuid.UUID) error
}

Jump to

Keyboard shortcuts

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