Documentation ¶ Index ¶ Constants Variables func InitDB() type Blade type Orders type Session type User func (user *User) CheckPassword(password string) bool func (user *User) SetPassword(password string) error Constants ¶ View Source const ( ACTIVE = iota INACTIVE = iota ) View Source const ( Normal = iota UnNormal = iota PasswordCost = 12 ) Variables ¶ View Source var DB *gorm.DB Functions ¶ func InitDB ¶ func InitDB() Types ¶ type Blade ¶ type Blade struct { gorm.Model Hostname string `gorm:"unique"` Traffic uint64 //traffic used Country string Status byte Address net.IP Password string UserName string Vendor string Users int BootStrapID string } type Orders ¶ type Orders struct { gorm.Model User User `gorm:"ForeignKey:Uid"` Uid uint `gorm:"not null"` ComboType byte RemainTraffic int64 StartTime time.Time EndTime time.Time } type Session ¶ type Session struct { gorm.Model User User `gorm:"ForeignKey:Uid"` Uid uint `gorm:"not null"` SessionID string `gorm:"PrimaryKey"` Traffic uint64 //traffic used Country string Status byte } type User ¶ type User struct { gorm.Model UserName string `gorm:"unique"` Password string Email string Token string Status int } func (*User) CheckPassword ¶ func (user *User) CheckPassword(password string) bool func (*User) SetPassword ¶ func (user *User) SetPassword(password string) error Source Files ¶ View all Source files blade.go order.go session.go users.go Click to show internal directories. Click to hide internal directories.