repositories

package
v0.0.0-...-18b5139 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

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,实现定义的接口

func NewProductManager

func NewProductManager(table string, db *sql.DB) IProduct

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) Conn

func (o *OrderMangerRepository) Conn() error

链接数据库

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) Conn

func (p *ProductManager) Conn() (err error)

数据连接

func (*ProductManager) Delete

func (p *ProductManager) Delete(productID int64) bool

商品的删除

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)

Jump to

Keyboard shortcuts

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