Documentation ¶
Index ¶
- type CategoryRepository
- type Item
- type ItemController
- func (ic *ItemController) CreateItem(c *gin.Context)
- func (ic *ItemController) DeleteItem(c *gin.Context)
- func (ic *ItemController) GetItemByID(c *gin.Context)
- func (ic *ItemController) GetItemBySlug(c *gin.Context)
- func (ic *ItemController) GetItems(c *gin.Context)
- func (ic *ItemController) GetVendorItems(c *gin.Context)
- func (ic *ItemController) UpdateItem(c *gin.Context)
- type ItemRepo
- func (ir *ItemRepo) CreateItem(item *Item) error
- func (ir *ItemRepo) DeleteItem(filter interface{}, opts ...*options.DeleteOptions) error
- func (ir *ItemRepo) GetItem(filter interface{}, opts ...*options.FindOneOptions) (*Item, error)
- func (ir *ItemRepo) GetItems(filter interface{}, opts ...*options.FindOptions) ([]*Item, error)
- func (ir *ItemRepo) IsExists(filter interface{}, opts ...*options.FindOneOptions) (bool, error)
- func (ir *ItemRepo) UpdateItem(filter interface{}, update interface{}, opts ...*options.UpdateOptions) error
- type ItemRepository
- type ItemService
- func (is *ItemService) CreateItem(item *Item) *errors.AppError
- func (is *ItemService) DeleteItem(itemId string, userId primitive.ObjectID) *errors.AppError
- func (is *ItemService) GetItemByID(itemId string) (*Item, *errors.AppError)
- func (is *ItemService) GetItemBySlug(slug string) (*Item, *errors.AppError)
- func (is *ItemService) GetItems() ([]*Item, *errors.AppError)
- func (is *ItemService) GetVendorItems(vendorid primitive.ObjectID) ([]*Item, *errors.AppError)
- func (is *ItemService) UpdateItem(item *Item) *errors.AppError
- func (is *ItemService) UploadImage(ctx context.Context, files []*multipart.FileHeader, collection string) ([]string, *errors.AppError)
- type ItemServices
- type Uploader
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CategoryRepository ¶
type CategoryRepository interface {
IsExists(filter interface{}, opts ...*options.FindOneOptions) (bool, error)
}
type Item ¶
type Item struct { ID primitive.ObjectID `json:"id" bson:"_id,omitempty"` Name string `json:"name" bson:"name"` Slug string `json:"slug" bson:"slug"` Description string `json:"description" bson:"description"` CategoryID []primitive.ObjectID `json:"category_id" bson:"category_id,omitempty"` Price float64 `json:"price" bson:"price"` Discount float64 `json:"discount" bson:"discount"` Quantity int `json:"quantity" bson:"quantity"` Images []string `json:"images" bson:"images"` VendorID primitive.ObjectID `json:"vendor_id" bson:"vendor_id,omitempty"` CreatedAt time.Time `json:"created_at" bson:"created_at"` UpdatedAt time.Time `json:"updated_at" bson:"updated_at"` }
type ItemController ¶
type ItemController struct {
// contains filtered or unexported fields
}
func NewItemController ¶
func NewItemController(itemServices ItemServices) *ItemController
func (*ItemController) CreateItem ¶
func (ic *ItemController) CreateItem(c *gin.Context)
func (*ItemController) DeleteItem ¶
func (ic *ItemController) DeleteItem(c *gin.Context)
func (*ItemController) GetItemByID ¶
func (ic *ItemController) GetItemByID(c *gin.Context)
func (*ItemController) GetItemBySlug ¶
func (ic *ItemController) GetItemBySlug(c *gin.Context)
func (*ItemController) GetItems ¶
func (ic *ItemController) GetItems(c *gin.Context)
func (*ItemController) GetVendorItems ¶
func (ic *ItemController) GetVendorItems(c *gin.Context)
func (*ItemController) UpdateItem ¶
func (ic *ItemController) UpdateItem(c *gin.Context)
type ItemRepo ¶
type ItemRepo struct {
Collection *mongo.Collection
}
func NewItemRepo ¶
func NewItemRepo(collection *mongo.Collection) *ItemRepo
func (*ItemRepo) CreateItem ¶
func (*ItemRepo) DeleteItem ¶
func (ir *ItemRepo) DeleteItem(filter interface{}, opts ...*options.DeleteOptions) error
func (*ItemRepo) GetItem ¶
func (ir *ItemRepo) GetItem(filter interface{}, opts ...*options.FindOneOptions) (*Item, error)
func (*ItemRepo) GetItems ¶
func (ir *ItemRepo) GetItems(filter interface{}, opts ...*options.FindOptions) ([]*Item, error)
func (*ItemRepo) IsExists ¶
func (ir *ItemRepo) IsExists(filter interface{}, opts ...*options.FindOneOptions) (bool, error)
func (*ItemRepo) UpdateItem ¶
func (ir *ItemRepo) UpdateItem(filter interface{}, update interface{}, opts ...*options.UpdateOptions) error
type ItemRepository ¶
type ItemRepository interface { IsExists(filter interface{}, opts ...*options.FindOneOptions) (bool, error) CreateItem(item *Item) error UpdateItem(filter interface{}, update interface{}, opts ...*options.UpdateOptions) error GetItem(filter interface{}, opts ...*options.FindOneOptions) (*Item, error) GetItems(filter interface{}, opts ...*options.FindOptions) ([]*Item, error) DeleteItem(filter interface{}, opts ...*options.DeleteOptions) error }
type ItemService ¶
type ItemService struct {
// contains filtered or unexported fields
}
func NewItemService ¶
func NewItemService(itemRepository ItemRepository, categoryRepository CategoryRepository, uploader Uploader) *ItemService
func (*ItemService) CreateItem ¶
func (is *ItemService) CreateItem(item *Item) *errors.AppError
func (*ItemService) DeleteItem ¶
func (*ItemService) GetItemByID ¶
func (is *ItemService) GetItemByID(itemId string) (*Item, *errors.AppError)
func (*ItemService) GetItemBySlug ¶
func (is *ItemService) GetItemBySlug(slug string) (*Item, *errors.AppError)
func (*ItemService) GetVendorItems ¶
func (*ItemService) UpdateItem ¶
func (is *ItemService) UpdateItem(item *Item) *errors.AppError
func (*ItemService) UploadImage ¶
func (is *ItemService) UploadImage(ctx context.Context, files []*multipart.FileHeader, collection string) ([]string, *errors.AppError)
type ItemServices ¶
type ItemServices interface { CreateItem(item *Item) *errors.AppError DeleteItem(itemId string, userId primitive.ObjectID) *errors.AppError GetItems() ([]*Item, *errors.AppError) UpdateItem(item *Item) *errors.AppError GetItemByID(itemId string) (*Item, *errors.AppError) GetItemBySlug(slug string) (*Item, *errors.AppError) GetVendorItems(vendorId primitive.ObjectID) ([]*Item, *errors.AppError) UploadImage(ctx context.Context, files []*multipart.FileHeader, collection string) ([]string, *errors.AppError) }
Click to show internal directories.
Click to hide internal directories.