Documentation ¶
Index ¶
- type IOrderRepository
- type IProduct
- type IUserRepository
- type OrderMangerRepository
- func (o *OrderMangerRepository) Conn() error
- func (o *OrderMangerRepository) Delete(orderID int64) (isOk bool)
- func (o *OrderMangerRepository) Insert(order *datamodels.Order) (productID int64, err error)
- func (o *OrderMangerRepository) SelectAll() (orderArray []*datamodels.Order, err error)
- func (o *OrderMangerRepository) SelectAllWithInfo() (OrderMap map[int]map[string]string, err error)
- func (o *OrderMangerRepository) SelectByKey(orderID int64) (order *datamodels.Order, err error)
- func (o *OrderMangerRepository) Update(order *datamodels.Order) (err error)
- type ProductManager
- func (p *ProductManager) Conn() (err error)
- func (p *ProductManager) Delete(productID int64) bool
- func (p *ProductManager) Insert(product *datamodels.Product) (productId int64, err error)
- func (p *ProductManager) SelectAll() (productArray []*datamodels.Product, errProduct error)
- func (p *ProductManager) SelectByKey(productID int64) (productResult *datamodels.Product, err error)
- func (p *ProductManager) Update(product *datamodels.Product) error
- type UserManagerRepository
- func (u *UserManagerRepository) Conn() (err error)
- func (u *UserManagerRepository) Insert(user *datamodels.User) (userId int64, err error)
- func (u *UserManagerRepository) Select(userName string) (user *datamodels.User, err error)
- func (u *UserManagerRepository) SelectByID(userId int64) (user *datamodels.User, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IOrderRepository ¶
type IOrderRepository interface { Conn() error Insert(*datamodels.Order) (int64, error) Delete(int64) bool Update(*datamodels.Order) error SelectByKey(int64) (*datamodels.Order, error) SelectAll() ([]*datamodels.Order, error) SelectAllWithInfo() (map[int]map[string]string, error) }
func NewOrderMangerRepository ¶
func NewOrderMangerRepository(table string, sql *sql.DB) IOrderRepository
type IProduct ¶
type IProduct interface { //连接数据 Conn() error Insert(*datamodels.Product) (int64, error) Delete(int64) bool Update(*datamodels.Product) error SelectByKey(int64) (*datamodels.Product, error) SelectAll() ([]*datamodels.Product, error) }
1,先开发对应的接口 2,实现定义的接口
type IUserRepository ¶
type IUserRepository interface { Conn() error Select(userName string) (user *datamodels.User, err error) Insert(user *datamodels.User) (userId int64, err error) }
func NewUserRepository ¶
func NewUserRepository(table string, db *sql.DB) IUserRepository
type OrderMangerRepository ¶
type OrderMangerRepository struct {
// contains filtered or unexported fields
}
func (*OrderMangerRepository) Delete ¶
func (o *OrderMangerRepository) Delete(orderID int64) (isOk bool)
func (*OrderMangerRepository) Insert ¶
func (o *OrderMangerRepository) Insert(order *datamodels.Order) (productID int64, err error)
func (*OrderMangerRepository) SelectAll ¶
func (o *OrderMangerRepository) SelectAll() (orderArray []*datamodels.Order, err error)
func (*OrderMangerRepository) SelectAllWithInfo ¶
func (o *OrderMangerRepository) SelectAllWithInfo() (OrderMap map[int]map[string]string, err error)
func (*OrderMangerRepository) SelectByKey ¶
func (o *OrderMangerRepository) SelectByKey(orderID int64) (order *datamodels.Order, err error)
func (*OrderMangerRepository) Update ¶
func (o *OrderMangerRepository) Update(order *datamodels.Order) (err error)
type ProductManager ¶
type ProductManager struct {
// contains filtered or unexported fields
}
func (*ProductManager) Insert ¶
func (p *ProductManager) Insert(product *datamodels.Product) (productId int64, err error)
插入
func (*ProductManager) SelectAll ¶
func (p *ProductManager) SelectAll() (productArray []*datamodels.Product, errProduct error)
获取所有商品
func (*ProductManager) SelectByKey ¶
func (p *ProductManager) SelectByKey(productID int64) (productResult *datamodels.Product, err error)
根据商品ID查询商品
func (*ProductManager) Update ¶
func (p *ProductManager) Update(product *datamodels.Product) error
商品的更新
type UserManagerRepository ¶
type UserManagerRepository struct {
// contains filtered or unexported fields
}
func (*UserManagerRepository) Conn ¶
func (u *UserManagerRepository) Conn() (err error)
func (*UserManagerRepository) Insert ¶
func (u *UserManagerRepository) Insert(user *datamodels.User) (userId int64, err error)
func (*UserManagerRepository) Select ¶
func (u *UserManagerRepository) Select(userName string) (user *datamodels.User, err error)
func (*UserManagerRepository) SelectByID ¶
func (u *UserManagerRepository) SelectByID(userId int64) (user *datamodels.User, err error)
Click to show internal directories.
Click to hide internal directories.