services

package
v0.0.0-...-5a2b5b4 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2023 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddArticle

func AddArticle(title string, content string, primaryImageUrl string, writerID uint) error

func AddProductIntoUserCart

func AddProductIntoUserCart(userID uint, productID uint) error

func CreateComment

func CreateComment(uid uint, content string, post_id uint) error

func CreatePost

func CreatePost(uid uint, content string, imageURL *string, fileURL *string) error

func CreateProduct

func CreateProduct(uid uint, title string, price float64, description string, category string, primaryImageURL string) error

func DeleteProductFromUserCart

func DeleteProductFromUserCart(userID uint, productID uint) error

func EditProfile

func EditProfile(userID uint, updateData map[string]any) *gorm.DB

func FetchProfileList

func FetchProfileList(userID sql.NullInt64, role string) ([]gin.H, *gorm.DB)

func FetchUserProfile

func FetchUserProfile(id uint) (*model.User, *gorm.DB)

func FollowUser

func FollowUser(userID uint, followedUserID uint) error

func GetArticleDetail

func GetArticleDetail(userID sql.NullInt64, articleID int) (gin.H, error)

func ListArticles

func ListArticles(userID sql.NullInt64) ([]gin.H, error)

func ListFavoriteArticle

func ListFavoriteArticle(userID uint) ([]gin.H, error)

func ListFavoritePeople

func ListFavoritePeople(userID uint) ([]gin.H, *gorm.DB)

func ListPost

func ListPost() ([]model.Post, error)

func Login

func Login(username string, password string) (model.User, error)

func MarkArticle

func MarkArticle(userID uint, articleID uint) error

func RegisterUser

func RegisterUser(username string, password string, role string, sex string, tel string) error

func UnFollowUser

func UnFollowUser(userID uint, followedUserID uint) error

func UnMarkArticle

func UnMarkArticle(userID uint, articleID uint) error

Types

type CartProduct

type CartProduct struct {
	ID              uint    `json:"id"`
	Title           string  `json:"title"`
	Price           float64 `json:"price"`
	Description     string  `json:"description"`
	Category        string  `json:"category"`
	PrimaryImageURL string  `json:"primary_image_url"`
}

func ListUserCart

func ListUserCart(userID uint) ([]CartProduct, error)

type ListAllProduct

type ListAllProduct struct {
	ID              uint    `json:"id"`
	Title           string  `json:"title"`
	Price           float64 `json:"price"`
	Description     string  `json:"description"`
	Category        string  `json:"category"`
	PrimaryImageURL string  `json:"primary_image_url"`
	UserID          uint    `json:"user_id"`
}

func ListAllProducts

func ListAllProducts() ([]ListAllProduct, error)

type ListByCategoryProduct

type ListByCategoryProduct struct {
	ID              uint    `json:"id"`
	Title           string  `json:"title"`
	Price           float64 `json:"price"`
	Description     string  `json:"description"`
	PrimaryImageURL string  `json:"primary_image_url"`
	UserID          uint    `json:"user_id"`
}

func ListProductsByCategory

func ListProductsByCategory(category string) ([]ListByCategoryProduct, error)

type ListByUIDProduct

type ListByUIDProduct struct {
	ID              uint    `json:"id"`
	Title           string  `json:"title"`
	Price           float64 `json:"price"`
	Description     string  `json:"description"`
	Category        string  `json:"category"`
	PrimaryImageURL string  `json:"primary_image_url"`
}

func ListProductsByUID

func ListProductsByUID(uid uint) ([]ListByUIDProduct, error)

Jump to

Keyboard shortcuts

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