model

package
v0.0.0-...-79b3612 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

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

Jump to

Keyboard shortcuts

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