ent

package
v0.0.0-...-ae06870 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2020 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Draft

type Draft struct {
	Id     uint64      `json:"id,omitempty"`
	Stage  stage.Stage `json:"stage,omitempty"`
	UserId uint64      `json:"user_id,omitempty"`
}

func FindOrCreateDraft

func FindOrCreateDraft(ctx context.Context, db *sqlx.DB, userId uint64) (*Draft, error)

func (*Draft) GetId

func (u *Draft) GetId() uint64

func (*Draft) LineById

func (d *Draft) LineById(ctx context.Context, db *sqlx.DB, id uint64) (*DraftLine, error)

func (*Draft) LineByTitle

func (d *Draft) LineByTitle(ctx context.Context, db *sqlx.DB, title string) (*DraftLine, error)

func (*Draft) Lines

func (d *Draft) Lines(ctx context.Context, db *sqlx.DB) (lns []*DraftLine, err error)

func (*Draft) Next

func (d *Draft) Next(ctx context.Context, db *sqlx.DB, imgs pbimages.ImagesClient, sem pbsemantic.ProductsClient, accessToken string) (int, error)

func (*Draft) Prev

func (d *Draft) Prev(ctx context.Context, db *sqlx.DB) error

func (*Draft) SQLMap

func (u *Draft) SQLMap() map[string]driver.Value

func (*Draft) SQLTable

func (u *Draft) SQLTable() string

func (*Draft) SetId

func (u *Draft) SetId(id uint64)

func (*Draft) ToPb

func (d *Draft) ToPb() *pbproducts.Draft

func (*Draft) ValidateLineByStage

func (d *Draft) ValidateLineByStage(l *DraftLine) error

type DraftLine

type DraftLine struct {
	Id      uint64 `json:"id,omitempty"`
	DraftId uint64 `json:"draft_id,omitempty"`

	// First
	Title      string `json:"title,omitempty"`
	CategoryId uint64 `json:"category_id,omitempty"`

	// Second
	Price currency.ARS `json:"price,omitempty"`
	Stock uint64       `json:"stock,omitempty"`
}

func LineById

func LineById(ctx context.Context, db *sqlx.DB, id uint64) (*DraftLine, error)

func (*DraftLine) Clone

func (ln *DraftLine) Clone() (*DraftLine, error)

func (*DraftLine) Draft

func (ln *DraftLine) Draft(ctx context.Context, db *sqlx.DB) (*Draft, error)

func (*DraftLine) GetId

func (u *DraftLine) GetId() uint64

func (*DraftLine) SQLMap

func (u *DraftLine) SQLMap() map[string]driver.Value

func (*DraftLine) SQLTable

func (u *DraftLine) SQLTable() string

func (*DraftLine) SetId

func (u *DraftLine) SetId(id uint64)

func (*DraftLine) ToPb

type Product

type Product struct {
	Id     uint64 `json:"id,omitempty"`
	UserId uint64 `json:"user_id,omitempty"`

	Title      string `json:"title,omitempty"`
	CategoryId uint64 `json:"category_id,omitempty"`

	Price         currency.ARS `json:"price,omitempty"`
	Stock         uint64       `json:"stock,omitempty"`
	ReservedStock uint64       `json:"reserved_stock,omitempty"`
}

func FindProduct

func FindProduct(ctx context.Context, db *sqlx.DB, id uint64) (*Product, error)

func FindProductsById

func FindProductsById(ctx context.Context, db *sqlx.DB, ids []uint64) ([]*Product, error)

func (*Product) ConsumeStockReserve

func (p *Product) ConsumeStockReserve(qt uint64) error

func (*Product) GetAttributes

func (p *Product) GetAttributes(ctx context.Context, sem pbsemantic.ProductsClient) (map[uint64]*pbproducts.Attribute, error)

func (*Product) GetId

func (u *Product) GetId() uint64

func (*Product) Images

func (p *Product) Images(ctx context.Context, img pbimages.ImagesClient) (map[string]*pbimages.Image, error)

func (*Product) ReserveStock

func (p *Product) ReserveStock(qt uint64) error

func (*Product) SQLMap

func (u *Product) SQLMap() map[string]driver.Value

func (*Product) SQLTable

func (u *Product) SQLTable() string

func (*Product) SetId

func (u *Product) SetId(id uint64)

func (*Product) ToPb

func (p *Product) ToPb() *pbproducts.Product

func (*Product) UndoStockReserve

func (p *Product) UndoStockReserve(qt uint64) error

func (*Product) User

func (p *Product) User(ctx context.Context, users pbusers.ViewerClient) (*pbusers.User, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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