Documentation ¶
Index ¶
- func AddBook(b *model.Book) error
- func AddCart(cart *model.Cart) error
- func AddCartItem(cartItem *model.CartItem) error
- func AddOrder(order *model.Order) error
- func AddOrderItem(orderItem *model.OrderItem) error
- func AddSession(sess *model.Session) error
- func CheckUsernameAndPassword(username, password string) (user *model.User, err error)
- func DeleteBookByID(id string) error
- func DeleteCartByCartID(cartID string) error
- func DeleteCartItemByID(cartItemID string) error
- func DeleteCartItemsByCartID(cartID string) error
- func DeleteSession(sessID string) error
- func FindIDByUsername(username string) (id int)
- func GetBookByID(id string) (*model.Book, error)
- func GetBooks() ([]*model.Book, error)
- func GetCartByUserID(userID int) (*model.Cart, error)
- func GetCartItemByBookIDAndCartID(bookID, cartID string) (*model.CartItem, error)
- func GetCartItemsByCartID(cartID string) ([]*model.CartItem, error)
- func GetOrderByUserID(userID int) ([]*model.Order, error)
- func GetOrderItemsByOrderID(orderID string) ([]*model.OrderItem, error)
- func GetOrders() ([]*model.Order, error)
- func GetPageBooks(pageNo string) (*model.Page, error)
- func GetPageBooksByPrice(pageNo string, minPrice string, maxPrice string) (*model.Page, error)
- func GetSessionByID(sessID string) (*model.Session, error)
- func InsertUser(username, password, email, key string) (err error)
- func IsLogin(r *http.Request) (bool, *model.Session)
- func UpdateBook(b *model.Book) error
- func UpdateBookCount(cartItem *model.CartItem) error
- func UpdateCart(cart *model.Cart) error
- func UpdateOrderState(orderID string, state int64) error
- func UserIDIsAdmin(userID int) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckUsernameAndPassword ¶
CheckUsernameAndPassword 验证用户账号和密码是否匹配
func DeleteCartByCartID ¶
DeleteCartByCartID 根据购物车的ID删除购物车
func DeleteCartItemByID ¶
DeleteCartItemByID 根据购物项的ID删除购物项
func DeleteCartItemsByCartID ¶
DeleteCartItemsByCartID 根据购物车的ID删除购物项
func FindIDByUsername ¶
FindIDByUsername 根据用户的姓名查找用户ID id>0表示找到了
func GetBookByID ¶
GetBookByID 根据图书ID从数据库中拿到所有图书的信息
func GetCartByUserID ¶
GetCartByUserID 根据用户ID找到用户在数据库中的购物车
func GetCartItemByBookIDAndCartID ¶
GetCartItemByBookIDAndCartID 根据书本ID和购物车ID查找购物项
func GetCartItemsByCartID ¶
GetCartItemsByCartID 根据购物车ID查找购物项
func GetOrderByUserID ¶
GetOrderByUserID 根据用户ID查找订单
func GetOrderItemsByOrderID ¶
GetOrderItemsByOrderID 根据订单的ID得到订单中的所有订单项
func GetPageBooksByPrice ¶
GetPageBooksByPrice 分页获取价格范围内的图书信息
func GetSessionByID ¶
GetSessionByID 根据ID查找session
func InsertUser ¶
InsertUser 向数据库中插入普通用户
func UpdateBookCount ¶
UpdateBookCount 根据购物项中相关信息更新数据库中对应的数量和总额
func UpdateOrderState ¶
UpdateOrderState 更新订单状态
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.