Documentation ¶
Index ¶
- func AddAddress(address Address) (uint64, error)
- func AddBook(book Book) (uint64, error)
- func AddCartItem(userID, bookID uint64) error
- func AddOrder(userID uint64, addressID uint, booksID []uint64) (uint64, error)
- func AddPurchasedNum(bookID uint64) (err error)
- func AddUser(name, passwd string) (id uint64)
- func CountAddresses(userID uint64) int
- func CountBooks(filter BooksFilter) (count uint64)
- func CountOrders(userID uint64) (count uint64, err error)
- func CountUsers(isAdmin bool) (count uint64)
- func DeleteAddress(id uint64) (err error)
- func GetBookCategories(id uint64) (categories []string)
- func GetCategories() (names []string)
- func GetPrivilegeSet(userID uint64) (perm.PrivilegeSet, error)
- func GetPrivileges(userID uint64) ([]string, error)
- func HasPrivilege(userID uint64, privilege string) bool
- func HasPrivileges(userID uint64, privileges []string) bool
- func SetPrivileges(userID uint64, privileges []string) (err error)
- func UpdateAddress(address Address) (err error)
- func UpdateBook(book Book) (err error)
- func UpdateCartItem(userID, bookID uint64, quantity uint) (err error)
- func UpdateCategories(bookID uint64, categories []string) (err error)
- func UpdateOrderStatus(id uint64, status string) (err error)
- func VerifyUser(name, passwd string) (id uint64)
- type Address
- type Addresses
- type Book
- type Books
- type BooksFilter
- type CartBook
- type CartBooks
- type Limit
- type Order
- type OrderItem
- type OrderItems
- type Orders
- type User
- type Users
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddAddress ¶
func AddCartItem ¶
func AddPurchasedNum ¶
func CountAddresses ¶
func CountBooks ¶
func CountBooks(filter BooksFilter) (count uint64)
func CountOrders ¶
func CountUsers ¶
func DeleteAddress ¶
func GetBookCategories ¶
func GetCategories ¶
func GetCategories() (names []string)
func GetPrivilegeSet ¶
func GetPrivilegeSet(userID uint64) (perm.PrivilegeSet, error)
func GetPrivileges ¶
func HasPrivilege ¶
func HasPrivileges ¶
func SetPrivileges ¶
func UpdateAddress ¶
func UpdateBook ¶
func UpdateCartItem ¶
func UpdateCategories ¶
func UpdateOrderStatus ¶
func VerifyUser ¶
Types ¶
type Address ¶
type Address struct { ID uint64 UserID uint64 Consignee string Phone string Province string City string County string TownShip string Detail string }
func GetAddress ¶
type Book ¶
type Book struct { ID uint64 // 数据库自增id,添加图书时不用填写 ISBN string Cover sql.NullString Name, Author string Price float64 Intro sql.NullString Deleted bool }
type BooksFilter ¶
type Order ¶
type OrderItems ¶
type OrderItems = []OrderItem
func GetOrderItems ¶
func GetOrderItems(orderID uint64) (orderItems OrderItems, err error)
Click to show internal directories.
Click to hide internal directories.