schema

package
v0.0.0-...-bf11267 Latest Latest
Warning

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

Go to latest
Published: May 1, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Product

type Product struct {
	bun.BaseModel

	ID    string `bun:"type:uuid,pk"`
	Name  string `bun:"name,notnull"`
	Qtd   uint64 `bun:"qtd,notnull"`
	Price int64  `bun:"price,notnull"`

	StockID string `bun:"type:uuid,notnull"`

	Stock *Stock `bun:"rel:belongs-to,join:stock_id=id"`
}

func FromProduct

func FromProduct(product *domain.Product) (*Product, error)

func (*Product) ToDomain

func (product *Product) ToDomain() (*domain.Product, error)

type Stock

type Stock struct {
	bun.BaseModel

	ID       string `bun:"type:uuid,pk"`
	Name     string `bun:"name"`
	Capacity uint64 `bun:"capacity"`

	Items []*Product `bun:"rel:has-many,join:id=stock_id"`
}

func FromStock

func FromStock(stock *domain.Stock) (*Stock, error)

func (*Stock) ToDomain

func (stock *Stock) ToDomain() (*domain.Stock, error)

Jump to

Keyboard shortcuts

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