Documentation
¶
Index ¶
- func MakeEmptyDatabase(DBPath string, migrationPath string) (*sql.DB, error)
- func OpenDatabase(DBPath string) (*sql.DB, error)
- func OpenRedis() *redis.Client
- type Customer
- type Item
- type Mall
- type MallCustomer
- type Store
- func (s *Store) Buy(user *User, orders []*MallCustomer) error
- func (s *Store) CreateMall(user *User, mall *Mall, items []*Item) error
- func (s *Store) GetCustomersByMallId(mallId int64) ([]*Customer, error)
- func (s *Store) GetItemById(itemId int64) (*Item, error)
- func (s *Store) GetItemsByMallId(mallId int64) ([]*Item, error)
- func (s *Store) GetMallById(mallId int64) (*Mall, error)
- func (s *Store) GetMalls() ([]*Mall, error)
- func (s *Store) GetMallsByUserId(userId int64) ([]*Mall, error)
- func (s *Store) GetOrdersByItemId(itemId int64) ([]*MallCustomer, error)
- func (s *Store) GetOrdersByMallId(mallId int64) ([]*MallCustomer, error)
- func (s *Store) GetOrdersByUserId(userId int64) ([]*MallCustomer, error)
- func (s *Store) GetUserById(id int64) (*User, error)
- func (s *Store) GetUserByUsername(username string) (*User, error)
- func (s *Store) InsertItem(tx *sql.Tx, item *Item) error
- func (s *Store) InsertMall(tx *sql.Tx, mall *Mall) error
- func (s *Store) InsertUser(user *User) error
- func (s *Store) UpdateMall(mall *Mall) error
- func (s *Store) ValidUser(user *User) bool
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MakeEmptyDatabase ¶
Types ¶
type Mall ¶
type Mall struct { Id int64 `json:"id"` UserId int64 `json:"userid"` // BeginTime and EndTime are stored in format of unix timestamp BeginTime int64 `json:"begintime"` EndTime int64 `json:"endtime"` // state == 0 means the mall is canceled // state == 1 means the mall is open State int64 `json:"state"` }
type MallCustomer ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func (*Store) GetCustomersByMallId ¶
func (*Store) GetOrdersByItemId ¶
func (s *Store) GetOrdersByItemId(itemId int64) ([]*MallCustomer, error)
func (*Store) GetOrdersByMallId ¶
func (s *Store) GetOrdersByMallId(mallId int64) ([]*MallCustomer, error)
func (*Store) GetOrdersByUserId ¶
func (s *Store) GetOrdersByUserId(userId int64) ([]*MallCustomer, error)
func (*Store) InsertUser ¶
func (*Store) UpdateMall ¶
Click to show internal directories.
Click to hide internal directories.