db

package
v0.0.0-...-da7c1d3 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cart

type Cart struct {
	UserId    int64 `gorm:"primary_key"`
	SkuJson   string
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt gorm.DeletedAt `sql:"index"`
}

func (Cart) TableName

func (Cart) TableName() string

type DBAdapter

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

DBAdapter impl PersistencePort defined in use case package

func NewDBAdapter

func NewDBAdapter(client *gorm.DB) *DBAdapter

func (*DBAdapter) CreateCart

func (c *DBAdapter) CreateCart(ctx context.Context, uid int64, cart string) error

CreateCart 创建购物车

func (*DBAdapter) GetCartByUserId

func (c *DBAdapter) GetCartByUserId(ctx context.Context, uid int64) (bool, *model.Cart, error)

GetCartByUserId 查询购物车

func (*DBAdapter) SaveCart

func (c *DBAdapter) SaveCart(ctx context.Context, uid int64, cart string) error

SaveCart 保存更新后的购物车

Jump to

Keyboard shortcuts

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