db

package
v0.0.0-...-484b376 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthPortToUser

func AuthPortToUser(port int64, userId int64) error

func AuthSubDomainToUser

func AuthSubDomainToUser(subDomain string, userId int64) error

func CanUserUsePort

func CanUserUsePort(userId int64, port int64) bool

func CanUserUseSubDomain

func CanUserUseSubDomain(userId int64, subDomain string) bool

func CreateUser

func CreateUser(user *User) error

func GetConnection

func GetConnection() (*gorm.DB, error)

func InitTables

func InitTables()

Types

type ApplyAuth

type ApplyAuth struct {
	ApplyId         int64 `gorm:"primary_key;AUTO_INCREMENT"`
	ApplySubDomains string
	ApplyPorts      string
	Status          string
	PassSubDomains  string
	PassPorts       string
}

type PortAuth

type PortAuth struct {
	Port   int64 `gorm:"primary_key"`
	UserId int64
}

type SubDomainAuth

type SubDomainAuth struct {
	SubDomain string `gorm:"primary_key"`
	UserId    int64
}

type User

type User struct {
	UserId   int64 `gorm:"primary_key;AUTO_INCREMENT"`
	Username string
	Password string
	Token    string
	Role     string
	Status   string
}

func GetUserById

func GetUserById(id int64) (*User, error)

func GetUserByToken

func GetUserByToken(token string) (*User, error)

func ListUsers

func ListUsers() (users []User, err error)

func LoginGetUser

func LoginGetUser(username string, password string) (*User, error)

type UserWithAuth

type UserWithAuth struct {
	User
	SubDomain string
	Port      int64
}

func GetAllPortAuth

func GetAllPortAuth(userId int64) (ports []UserWithAuth, err error)

func GetAllSubDomainAuth

func GetAllSubDomainAuth(userId int64) (subDomains []UserWithAuth, err error)

Jump to

Keyboard shortcuts

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