models

package
v0.0.0-...-cae665e Latest Latest
Warning

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

Go to latest
Published: May 17, 2019 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ARTICLE_STOCK_SORTING_POPULARITY int = 1
	ARTICLE_STOCK_SORTING_PURCHASES  int = 2
	ARTICLE_STOCK_SORTING_RECENTS    int = 3
)

Variables

This section is empty.

Functions

func NewArticleDistinctFiltersFromArgs

func NewArticleDistinctFiltersFromArgs(args *map[string]interface{}, omitted ...string) interface{}

func NewArticleFiltersFromArgs

func NewArticleFiltersFromArgs(args *map[string]interface{}) bson.M

Types

type DistincItem

type DistincItem struct {
	Name  string `bson:"name"`
	Count int64  `bson:"count"`
}

type MaxMinItem

type MaxMinItem = struct {
	Min float64 `bson:"min"`
	Max float64 `bson:"max"`
}

type ModelArticle

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

func NewModelArticle

func NewModelArticle(db *mongo.Database) *ModelArticle

func (*ModelArticle) AddStock

func (model *ModelArticle) AddStock(article primitive.ObjectID, size string) (*defs.Stock, error)

func (*ModelArticle) Create

func (model *ModelArticle) Create(name string, description string, price float64, images []defs.File, category string, rating int8) (*defs.Article, error)

func (*ModelArticle) DeleteArticle

func (model *ModelArticle) DeleteArticle(id primitive.ObjectID) error

func (*ModelArticle) DistincUsingFilters

func (model *ModelArticle) DistincUsingFilters(path interface{}, filter ...interface{}) ([]DistincItem, error)

func (*ModelArticle) FindById

func (model *ModelArticle) FindById(id primitive.ObjectID) (interface{}, error)

func (*ModelArticle) FindOne

func (model *ModelArticle) FindOne(args *map[string]interface{}, opts ...*options.FindOneOptions) (interface{}, error)

func (*ModelArticle) FindSlice

func (model *ModelArticle) FindSlice(args *map[string]interface{}) (
	result []defs.Article,
	meta oprs.SliceMetadata,
	err error,
)

func (*ModelArticle) FindStockById

func (model *ModelArticle) FindStockById(stockId primitive.ObjectID) (*defs.StockArticle, error)

func (*ModelArticle) FindStockBySize

func (model *ModelArticle) FindStockBySize(stockSize string) (*defs.StockArticle, error)

func (*ModelArticle) GetCategories

func (model *ModelArticle) GetCategories(args *map[string]interface{}) ([]DistincItem, error)

func (*ModelArticle) GetCount

func (model *ModelArticle) GetCount() (int64, error)

func (*ModelArticle) GetPriceRange

func (model *ModelArticle) GetPriceRange(args *map[string]interface{}) (*MaxMinItem, error)

func (*ModelArticle) GetSizes

func (model *ModelArticle) GetSizes(args *map[string]interface{}) ([]DistincItem, error)

func (*ModelArticle) Sync

func (model *ModelArticle) Sync(article *defs.Article) error

func (*ModelArticle) UpdateArticle

func (model *ModelArticle) UpdateArticle(id primitive.ObjectID, name string, description string, price float64, images []string, category string, rating int8) error

func (*ModelArticle) UploadImage

func (model *ModelArticle) UploadImage(filename string, source io.Reader) (primitive.ObjectID, error)

type ModelOrder

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

ModelOrder asd

func NewModelOrder

func NewModelOrder(db *mongo.Database, modelArticle *ModelArticle, modelUser *ModelUser) *ModelOrder

NewOrderModel

func (*ModelOrder) Cancel

func (model *ModelOrder) Cancel(id primitive.ObjectID) (*defs.Order, error)

func (*ModelOrder) ConfirmReceived

func (model *ModelOrder) ConfirmReceived(id primitive.ObjectID) (*defs.Order, error)

func (*ModelOrder) Create

func (model *ModelOrder) Create(stock primitive.ObjectID, user primitive.ObjectID, notes string) (*defs.Order, error)

Create

func (*ModelOrder) FindById

func (model *ModelOrder) FindById(id primitive.ObjectID) (interface{}, error)

func (*ModelOrder) FindOne

func (model *ModelOrder) FindOne(args *map[string]interface{}) (interface{}, error)

func (*ModelOrder) FindSlice

func (model *ModelOrder) FindSlice(args *map[string]interface{}) ([]interface{}, *oprs.FindSliceMetadata, error)

func (*ModelOrder) GetCount

func (model *ModelOrder) GetCount() (int64, error)

func (*ModelOrder) GetState

func (model *ModelOrder) GetState(id primitive.ObjectID) (int8, error)

func (*ModelOrder) Prepare

func (model *ModelOrder) Prepare(id primitive.ObjectID) (*defs.Order, error)

func (*ModelOrder) Purchase

func (model *ModelOrder) Purchase(id primitive.ObjectID, paymentMethod int8, purchaseRef string) (*defs.Order, error)

func (*ModelOrder) Ship

func (model *ModelOrder) Ship(id primitive.ObjectID, trackingRef string) (*defs.Order, error)

func (*ModelOrder) Sync

func (model *ModelOrder) Sync(order *defs.Order) error

func (*ModelOrder) UpdateState

func (model *ModelOrder) UpdateState(id primitive.ObjectID, state int8) (*defs.Order, error)

type ModelUser

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

func NewModelUser

func NewModelUser(db *mongo.Database) *ModelUser

func (*ModelUser) Create

func (model *ModelUser) Create(name string, surname string, email string, phone string, address string) (*defs.User, error)

func (*ModelUser) FindById

func (model *ModelUser) FindById(id primitive.ObjectID) (interface{}, error)

func (*ModelUser) FindOne

func (model *ModelUser) FindOne(args *map[string]interface{}) (interface{}, error)

Jump to

Keyboard shortcuts

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