Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FreeTicketRepo ¶
type FreeTicketRepo struct{}
type Pay ¶
type Ticket ¶
type Ticket struct {
ID int `db:"id" json:"id"`
Token string `db:"token" json:"-"`
Bytes int `db:"bytes" json:"bytes"`
TotalBytes int `db:"total_bytes" json:"total_bytes"`
PayOrder string `db:"pay_order" json:"pay_order"`
BuyOrder string `db:"buy_order" json:"buy_order"`
Created time.Time `db:"created" json:"created"`
Updated time.Time `db:"updated" json:"updated"`
Expires time.Time `db:"expires" json:"expires"`
}
type TicketHandler ¶
type TicketHandler struct {
MBpCNY int
Pay Pay
Repo TicketRepo
AltSvc string
}
func (*TicketHandler) ServeHTTP ¶
func (h *TicketHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type TicketRepo ¶
type TicketRepo interface {
// New create and save one Ticket
New(token string, bytes int, trade string, order string) error
// Cost decreases bytes of one Ticket
Cost(token string, bytes int) error
// List fetches all current Tickets with bytes available.
List(token string, limit int) ([]Ticket, error)
}
func NewTicketRepo ¶
func NewTicketRepo(path string) TicketRepo
Click to show internal directories.
Click to hide internal directories.