db

package
v0.0.0-...-ded5120 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddIngredientParams

type AddIngredientParams struct {
	Nome  string `json:"nome"`
	Ativo bool   `json:"ativo"`
}

type DBTX

type DBTX interface {
	ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
	PrepareContext(context.Context, string) (*sql.Stmt, error)
	QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)
	QueryRowContext(context.Context, string, ...interface{}) *sql.Row
}

type Ingredient

type Ingredient struct {
	ID       int64     `json:"id"`
	Nome     string    `json:"nome"`
	Ativo    bool      `json:"ativo"`
	CriadoEm time.Time `json:"criado_em"`
}

type ListIngredientsParams

type ListIngredientsParams struct {
	Limit  int32 `json:"limit"`
	Offset int32 `json:"offset"`
}

type Querier

type Querier interface {
	AddIngredient(ctx context.Context, arg AddIngredientParams) (Ingredient, error)
	DeleteIngredient(ctx context.Context, id int64) error
	GetIngreditent(ctx context.Context, id int64) (Ingredient, error)
	ListIngredients(ctx context.Context, arg ListIngredientsParams) ([]Ingredient, error)
	UpdateIngredient(ctx context.Context, arg UpdateIngredientParams) (Ingredient, error)
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) AddIngredient

func (q *Queries) AddIngredient(ctx context.Context, arg AddIngredientParams) (Ingredient, error)

func (*Queries) DeleteIngredient

func (q *Queries) DeleteIngredient(ctx context.Context, id int64) error

func (*Queries) GetIngreditent

func (q *Queries) GetIngreditent(ctx context.Context, id int64) (Ingredient, error)

func (*Queries) ListIngredients

func (q *Queries) ListIngredients(ctx context.Context, arg ListIngredientsParams) ([]Ingredient, error)

func (*Queries) UpdateIngredient

func (q *Queries) UpdateIngredient(ctx context.Context, arg UpdateIngredientParams) (Ingredient, error)

func (*Queries) WithTx

func (q *Queries) WithTx(tx *sql.Tx) *Queries

type SQLStore

type SQLStore struct {
	*Queries
	// contains filtered or unexported fields
}

type Store

type Store interface {
	Querier
}

func NewStore

func NewStore(db *sql.DB) Store

type UpdateIngredientParams

type UpdateIngredientParams struct {
	ID    int64  `json:"id"`
	Nome  string `json:"nome"`
	Ativo bool   `json:"ativo"`
}

Jump to

Keyboard shortcuts

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