dao

package
v0.0.0-...-cead0cf Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Database

func Database(connRead, connWrite string)

func NewDBClient

func NewDBClient(ctx context.Context) *gorm.DB

Types

type AddressDao

type AddressDao struct {
	*gorm.DB
}

func NewAddressDao

func NewAddressDao(ctx context.Context) *AddressDao

func (*AddressDao) CreateAddress

func (dao *AddressDao) CreateAddress(in *model.Address) error

func (*AddressDao) DeleteAddressByAddressId

func (dao *AddressDao) DeleteAddressByAddressId(aId, uId uint) error

func (*AddressDao) GetAddressByAid

func (dao *AddressDao) GetAddressByAid(aId uint) (address *model.Address, err error)

func (*AddressDao) ListAddressByUserId

func (dao *AddressDao) ListAddressByUserId(uId uint) (addresses []*model.Address, err error)

func (*AddressDao) UpdateAddressByUserId

func (dao *AddressDao) UpdateAddressByUserId(aId uint, address *model.Address) error

type CarouselDao

type CarouselDao struct {
	*gorm.DB
}

func NewCarouselDao

func NewCarouselDao(ctx context.Context) *CarouselDao

func NewCarouselDaoByDB

func NewCarouselDaoByDB(db *gorm.DB) *CarouselDao

func (*CarouselDao) CreateCarousel

func (dao *CarouselDao) CreateCarousel(carousel *model.Carousel) error

CreateCarousel 创建Carousel

func (*CarouselDao) ListCarousel

func (dao *CarouselDao) ListCarousel() (carousel []model.Carousel, err error)

GetUserById 根据 id 获取 user

type CartDao

type CartDao struct {
	*gorm.DB
}

func NewCartDao

func NewCartDao(ctx context.Context) *CartDao

func (*CartDao) CreateCart

func (dao *CartDao) CreateCart(in *model.Cart) error

func (*CartDao) DeleteCartByCartId

func (dao *CartDao) DeleteCartByCartId(cId, uId uint) error

func (*CartDao) GetCartByAid

func (dao *CartDao) GetCartByAid(aId uint) (cart *model.Cart, err error)

func (*CartDao) ListCartByUserId

func (dao *CartDao) ListCartByUserId(uId uint) (cartes []*model.Cart, err error)

func (*CartDao) UpdateCartNumById

func (dao *CartDao) UpdateCartNumById(cId uint, num int) error

type CategoryDao

type CategoryDao struct {
	*gorm.DB
}

func NewCategoryDao

func NewCategoryDao(ctx context.Context) *CategoryDao

func NewCategoryDaoByDB

func NewCategoryDaoByDB(db *gorm.DB) *CategoryDao

func (*CategoryDao) ListCategory

func (dao *CategoryDao) ListCategory() (category []model.Category, err error)

type FavoriteDao

type FavoriteDao struct {
	*gorm.DB
}

func NewFavoriteDao

func NewFavoriteDao(ctx context.Context) *FavoriteDao

func NewFavoriteDaoByDB

func NewFavoriteDaoByDB(db *gorm.DB) *FavoriteDao

func (*FavoriteDao) CreateFavorite

func (dao *FavoriteDao) CreateFavorite(in *model.Favorite) error

func (*FavoriteDao) DeleteFavorite

func (dao *FavoriteDao) DeleteFavorite(uId, fId uint) error

DeleteFavorite 删除收藏夹

func (*FavoriteDao) FavoriteExistOrNot

func (dao *FavoriteDao) FavoriteExistOrNot(pId, uId uint) (exist bool, err error)

func (*FavoriteDao) ListFavorite

func (dao *FavoriteDao) ListFavorite(uId uint) (resp []*model.Favorite, err error)

type NoticeDao

type NoticeDao struct {
	*gorm.DB
}

func NewNoticeDao

func NewNoticeDao(ctx context.Context) *NoticeDao

func NewNoticeDaoByDB

func NewNoticeDaoByDB(db *gorm.DB) *NoticeDao

func (*NoticeDao) CreateNotice

func (dao *NoticeDao) CreateNotice(notice *model.Notice) error

CreateNotice 创建notice

func (*NoticeDao) GetNoticeById

func (dao *NoticeDao) GetNoticeById(id uint) (notice *model.Notice, err error)

GetNoticeById 根据 id 获取 notice

type OrderDao

type OrderDao struct {
	*gorm.DB
}

func NewOrderDao

func NewOrderDao(ctx context.Context) *OrderDao

func (*OrderDao) CreateOrder

func (dao *OrderDao) CreateOrder(in *model.Order) error

func (*OrderDao) DeleteOrderByOrderId

func (dao *OrderDao) DeleteOrderByOrderId(aId, uId uint) error

func (*OrderDao) GetOrderById

func (dao *OrderDao) GetOrderById(id, uId uint) (order *model.Order, err error)

func (*OrderDao) ListOrderByCondition

func (dao *OrderDao) ListOrderByCondition(condition map[string]interface{}, page model.BasePage) (orders []*model.Order, total int64, err error)

ListOrderByCondition 获取订单List

func (*OrderDao) ListOrderByUserId

func (dao *OrderDao) ListOrderByUserId(uId uint) (orderes []*model.Order, err error)

func (*OrderDao) UpdateOrderByUserId

func (dao *OrderDao) UpdateOrderByUserId(aId uint, order *model.Order) error

type ProductDao

type ProductDao struct {
	*gorm.DB
}

func NewProductDao

func NewProductDao(ctx context.Context) *ProductDao

func NewProductDaoByDB

func NewProductDaoByDB(db *gorm.DB) *ProductDao

func (*ProductDao) CountProductByCondition

func (dao *ProductDao) CountProductByCondition(condition map[string]interface{}) (total int64, err error)

func (*ProductDao) CreateProduct

func (dao *ProductDao) CreateProduct(product *model.Product) (err error)

func (*ProductDao) GetProductById

func (dao *ProductDao) GetProductById(id uint) (product *model.Product, err error)

func (*ProductDao) ListProductByCondition

func (dao *ProductDao) ListProductByCondition(condition map[string]interface{}, page model.BasePage) (products []*model.Product, err error)

func (*ProductDao) SearchProduct

func (dao *ProductDao) SearchProduct(info string, page model.BasePage) (products []*model.Product, count int64, err error)

func (*ProductDao) UpdateProduct

func (dao *ProductDao) UpdateProduct(id uint, product *model.Product) error

type ProductImgDao

type ProductImgDao struct {
	*gorm.DB
}

func NewProductImgDao

func NewProductImgDao(ctx context.Context) *ProductImgDao

func NewProductImgDaoByDB

func NewProductImgDaoByDB(db *gorm.DB) *ProductImgDao

func (*ProductImgDao) CreateProductImg

func (dao *ProductImgDao) CreateProductImg(productImg *model.ProductImg) error

func (*ProductImgDao) ListProductImg

func (dao *ProductImgDao) ListProductImg(id uint) (productImg []*model.ProductImg, err error)

type UserDao

type UserDao struct {
	*gorm.DB
}

func NewUserDao

func NewUserDao(ctx context.Context) *UserDao

func NewUserDaoByDB

func NewUserDaoByDB(db *gorm.DB) *UserDao

func (*UserDao) CreateUser

func (dao *UserDao) CreateUser(user *model.User) error

CreateUser 创建用户

func (*UserDao) ExistOrNotByUserName

func (dao *UserDao) ExistOrNotByUserName(userName string) (user *model.User, exist bool, err error)

ExistOrNotByUserName 根据username判断是否存在该名字

func (*UserDao) GetUserById

func (dao *UserDao) GetUserById(id uint) (user *model.User, err error)

GetUserById 根据 id 获取 user

func (*UserDao) UpdateUserById

func (dao *UserDao) UpdateUserById(uId uint, user *model.User) error

UpdateUserById 根据 id 修改用户昵称

Jump to

Keyboard shortcuts

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