data

package
v0.0.0-...-2e5ecab Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrRecordNotFound = errors.New("record not found")
)

Functions

func ConvertPvzParamsToReceptionsParams

func ConvertPvzParamsToReceptionsParams(src api.GetPvzParams) db.GetPVZsWithReceptionsParams

Types

type Models

type Models struct {
	PVZv1 PVZModelv1
	PVZ   PVZModel
}

func NewModels

func NewModels(db_ *sql.DB) (Models, error)

func (*Models) AddPVZ

func (m *Models) AddPVZ(reqCtx context.Context, req api.PVZ) (db.CreatePVZRow, error)

func (*Models) AddProduct

func (m *Models) AddProduct(reqCtx context.Context, req api.PostProductsJSONBody) (db.AddProductRow, error)

func (*Models) AddReception

func (*Models) CloseLastReception

func (m *Models) CloseLastReception(reqCtx context.Context, req openapi_types.UUID) (db.CloseReceptionRow, error)

func (*Models) DeleteLastProduct

func (m *Models) DeleteLastProduct(reqCtx context.Context, req openapi_types.UUID) error

func (*Models) GetPVZ

func (*Models) Login

func (m *Models) Login(reqCtx context.Context, req api.PostLoginJSONBody) (string, error)

func (*Models) ReadOnlyTransaction

func (m *Models) ReadOnlyTransaction(ctx context.Context, fn func(*db.Queries) error) error

ReadOnlyTransaction executes a function within a read-only transaction

func (*Models) Register

func (m *Models) Register(reqCtx context.Context, req api.PostRegisterJSONBody) (db.CreateUserRow, error)

func (*Models) Transaction

func (m *Models) Transaction(ctx context.Context, fn func(*db.Queries) error) error

Transaction executes a function within a database transaction

type PVZModel

type PVZModel struct {
	DB      *sql.DB
	Queries *db.Queries
}

type PVZModelv1

type PVZModelv1 struct {
	DB *sql.DB
}

type PVZWithReceptionsResponse

type PVZWithReceptionsResponse struct {
	PVZ        api.PVZ                 `json:"pvz"`
	Receptions []ReceptionWithProducts `json:"receptions"`
}

PVZWithReceptionsResponse matches the expected API response format

type ReceptionWithProducts

type ReceptionWithProducts struct {
	Reception api.Reception `json:"reception"`
	Products  []api.Product `json:"products"`
}

ReceptionWithProducts matches the nested structure in the API spec

Jump to

Keyboard shortcuts

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