dao

package
v0.0.0-...-400441b Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Address

type Address struct {
	Model
	Title       string `json:"title"`
	Receiver    string `json:"receiver"`
	PhoneNumber string `json:"phone_number"`
	Details     string `json:"details" gorm:"type:text"`
	UserID      uint   `json:"user_id" gorm:"not null"`
}

Address is a struct that represent the address table in database

type Category

type Category struct {
	Model
	Name     string    `json:"name" gorm:"unique;not null"`
	Products []Product `json:"product"`
}

Category is a struct that represent the category table in database

type Model

type Model struct {
	ID        uint `gorm:"primarykey"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt gorm.DeletedAt `gorm:"index"`
}

Model is a basic physical data model for data objects.

type Product

type Product struct {
	Model
	Name          string         `json:"name"`
	Slug          string         `json:"slug"`
	ResellerPrice int            `json:"reseller_price"`
	RetailPrice   int            `json:"retail_price"`
	Stock         int            `json:"stock"`
	Description   string         `json:"description" gorm:"type:text"`
	ShopID        uint           `json:"shop_id" gorm:"not null"`
	Shop          *Shop          `json:"shop"`
	CategoryID    uint           `json:"category_id" gorm:"not null"`
	Category      *Category      `json:"category"`
	Photos        []ProductPhoto `json:"photos" gorm:"foreignKey:ProductID"`
}

Product is a struct that represent the product table in database

type ProductLog

type ProductLog struct {
	Model
	ProductID     uint           `json:"product_id" gorm:"not null"`
	Name          string         `json:"name"`
	Slug          string         `json:"slug"`
	ResellerPrice int            `json:"reseller_price"`
	RetailPrice   int            `json:"retail_price"`
	Description   string         `json:"description" gorm:"type:text"`
	ShopID        uint           `json:"shop_id" gorm:"not null"`
	Shop          *Shop          `json:"shop"`
	CategoryID    uint           `json:"category_id" gorm:"not null"`
	Category      *Category      `json:"category"`
	Photos        []ProductPhoto `json:"photos" gorm:"foreignKey:ProductLogID"`
}

ProductLog is a struct that represent the product_logs table in database

type ProductPhoto

type ProductPhoto struct {
	Model
	Url          string `json:"url"`
	ProductID    uint   `json:"product_id" gorm:"not null;index"`
	ProductLogID uint   `json:"product_log_id" gorm:"not null;index"`
}

ProductPhoto is a struct that represent the product_photos table in database

type Shop

type Shop struct {
	Model
	Name           string    `json:"name"`
	ProfilePicture string    `json:"profile_picture"`
	UserID         uint      `json:"user_id" gorm:"not null"`
	Products       []Product `json:"product"`
}

Shop is a struct that represent the shop table in databasek

type Transaction

type Transaction struct {
	Model
	TotalPrice         uint                `json:"total_price"`
	Invoice            string              `json:"invoice" gorm:"unique;not null"`
	PaymentMethod      string              `json:"payment_method"`
	UserID             uint                `json:"user_id"`
	User               User                `json:"user"`
	AddressID          uint                `json:"address_id"`
	Address            Address             `json:"address"`
	TransactionDetails []TransactionDetail `json:"transaction_detail"`
}

Transaction is a struct that represent the transaction table in database

type TransactionDetail

type TransactionDetail struct {
	Model
	Quantity      uint        `json:"quantity"`
	TotalPrice    uint        `json:"total_price"`
	TransactionID uint        `json:"transaction_id"`
	Transaction   Transaction `json:"transaction"`
	ProductLogID  uint        `json:"product_log_id"`
	ProductLog    ProductLog  `json:"product_log"`
	ShopID        uint        `json:"shop_id"`
	Shop          Shop        `json:"shop"`
}

TransactionDetail is a struct that represent the transaction_details table in database

type User

type User struct {
	Model
	Name         string        `json:"name"`
	Password     string        `json:"password"`
	PhoneNumber  string        `json:"phone_number" gorm:"unique;not null"`
	Email        string        `json:"email" gorm:"unique;not null"`
	BirthDate    time.Time     `json:"birth_date" `
	About        string        `json:"about" gorm:"type:text"`
	Job          string        `json:"job"`
	ProvinceID   string        `json:"province_id"`
	CityID       string        `json:"city_id"`
	Addresses    []Address     `json:"address"`
	Shop         *Shop         `gorm:"foreignkey:UserID"`
	Transactions []Transaction `json:"transaction"`
	IsAdmin      bool          `json:"is_admin" gorm:"default:false"`
}

User is a struct that represent the user table in database

Jump to

Keyboard shortcuts

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