models

package
v0.0.0-...-6fd4c63 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete

func Delete(id primitive.ObjectID) (int64, error)

func DeleteProduct

func DeleteProduct(id primitive.ObjectID) (int64, error)

func UpdateOrderStatus

func UpdateOrderStatus(id primitive.ObjectID, status string) (int64, error)

func UpdateProduct

func UpdateProduct(product Product, id primitive.ObjectID) (int64, error)

func UpdateProfile

func UpdateProfile(user User, userId primitive.ObjectID) (int64, error)

func UpdateRev

func UpdateRev(review Review, id primitive.ObjectID) (int64, error)

Types

type Order

type Order struct {
	ID            primitive.ObjectID `json:"_id,omitempty" bson:"_id,omitempty"`
	ProductId     primitive.ObjectID `json:"product_id,omitempty" bson:"product_id,omitempty"`
	Price         int64              `json:"price" bson:"price"`
	ShippingPrice int64              `json:"shipping_price"  bson:"shipping_price"`
	TotalPrice    int64              `json:"total_price" bson:"total_price"`
	Status        string             `json:"status" bson:"status"`
	ShippingId    primitive.ObjectID `json:"shipping_id" bson:"shipping_id"`
}

func GetAOrder

func GetAOrder(id primitive.ObjectID) (*Order, error)

func GetAllOrder

func GetAllOrder() ([]Order, error)

func (*Order) CreateOrder

func (order *Order) CreateOrder() (string, error)

type Product

type Product struct {
	ID            primitive.ObjectID `json:"_id,omitempty" bson:"_id,omitempty"`
	Name          string             `json:"name,omitempty" bson:"name,omitempty"`
	Description   string             `json:"description,omitempty" bson:"description,omitempty"`
	Price         float64            `json:"price,omitempty" bson:"price,omitempty"`
	Color         []string           `json:"color" bson:"color"`
	Images        []string           `json:"images" bson:"images"`
	CreatedBy     primitive.ObjectID `json:"createdBy,omitempty" bson:"createdBy,omitempty"`
	AverageReview float64            `json:"averageReview" bson:"averageReview"`
}

func GetByID

func GetByID(id string) (*Product, error)

func GetProducts

func GetProducts(query bson.D) ([]Product, error)

func (*Product) CreateProduct

func (product *Product) CreateProduct() (string, error)

type Review

type Review struct {
	ID          primitive.ObjectID `json:"_id,omitempty" bson:"_id,omitempty"`
	Title       string             `json:"title,omitempty"`
	Description string             `json:"description"`
	Rating      float64            `json:"rating"`
	ProductId   primitive.ObjectID `json:"productId" bson:"productId"`
}

func GetRev

func GetRev(id primitive.ObjectID) (*Review, error)

func GetReviews

func GetReviews() ([]Review, error)

func (*Review) CreateReview

func (review *Review) CreateReview() (string, error)

type Shipping

type Shipping struct {
	ID      primitive.ObjectID `json:"_id,omitempty" bson:"_id,omitempty"`
	FName   string             `json:"f_name" bson:"f_name"`
	LName   string             `json:"l_name" bson:"l_name"`
	Email   string             `json:"email" bson:"email"`
	PhoneNo string             `json:"phone_no"`
	Address string             `json:"address" bson:"address"`
	State   string             `json:"state" bson:"state"`
}

func (*Shipping) CreateShipingAddress

func (shipping *Shipping) CreateShipingAddress() (string, error)

type User

type User struct {
	ID       primitive.ObjectID `json:"_id" bson:"_id,omitempty"`
	FName    string             `json:"f_name"`
	LName    string             `json:"l_name"`
	Email    string             `json:"email,omitempty"`
	Password string             `json:"password,omitempty"`
	Gender   string             `json:"gender"`
	PhoneNo  string             `json:"phone_no"`
	Role     string             `json:"role"`
}

func GetAllUser

func GetAllUser() ([]User, error)

func GetById

func GetById(id string) (*User, error)

func UserLogin

func UserLogin(email string) (*User, error)

func (*User) CreateUser

func (user *User) CreateUser() (string, error)

Jump to

Keyboard shortcuts

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