dao

package
v0.0.0-...-deffa86 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CartDAO

type CartDAO struct {
	// contains filtered or unexported fields
}

func (*CartDAO) CreateCart

func (c *CartDAO) CreateCart(cart *models.Cart) (int64, error)

func (*CartDAO) DeleteCart

func (c *CartDAO) DeleteCart(userId int64) error

DeleteCart 删除购物车根据用户id

func (*CartDAO) FindAll

func (c *CartDAO) FindAll(UserId int64) ([]*models.Cart, error)

func (*CartDAO) FindAllByUserIdForCheckout

func (c *CartDAO) FindAllByUserIdForCheckout(userid int64) ([]*models.Cart, error)

func (*CartDAO) FindCartByUserIDandSKUID

func (c *CartDAO) FindCartByUserIDandSKUID(userid, skuid string) (*models.Cart, error)

func (*CartDAO) InitTable

func (c *CartDAO) InitTable()

func (*CartDAO) UpdateCart

func (c *CartDAO) UpdateCart(cart *models.Cart) (int64, error)

使用map更新,因为status默认零值,使用结构体会对零值不更新

type CartDAOInterface

type CartDAOInterface interface {
	InitTable()
	CreateCart(*models.Cart) (int64, error)
	DeleteCart(int64) error
	UpdateCart(*models.Cart) (int64, error)
	FindCartByUserIDandSKUID(userid, skuid string) (*models.Cart, error)
	FindAll(int64) ([]*models.Cart, error)
	FindAllByUserIdForCheckout(int64) ([]*models.Cart, error)
}

接口驱动设计(Interface-Driven Design)

func NewCartDAO

func NewCartDAO(db *gorm.DB) CartDAOInterface

Jump to

Keyboard shortcuts

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