Documentation ¶
Index ¶
- Constants
- func MustInitDBManager(dbs map[string]*gorm.DB, defaultDBType string)
- func NewDBManager(dbs map[string]*gorm.DB, defaultDBType string) *dbManagerImpl
- type Cert
- type Client
- type ClientEntity
- type DBManager
- type Server
- type ServerEntity
- type User
- type UserEntity
- func (u *UserEntity) GetEmail() string
- func (u *UserEntity) GetHashedPassword() string
- func (u *UserEntity) GetRole() string
- func (u *UserEntity) GetSafeUserInfo() UserEntity
- func (u *UserEntity) GetStatus() int
- func (u *UserEntity) GetTenantID() int
- func (u *UserEntity) GetToken() string
- func (u *UserEntity) GetUserID() int
- func (u *UserEntity) GetUserIDStr() string
- func (u *UserEntity) GetUserName() string
- func (u *UserEntity) IsAdmin() bool
- func (u *UserEntity) Valid() bool
- type UserInfo
Constants ¶
View Source
const ( ROLE_ADMIN = "admin" ROLE_NORMAL = "normal" )
View Source
const ( STATUS_UNKNOWN = iota STATUS_NORMAL STATUS_BANED )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Cert ¶
type Client ¶
type Client struct {
*ClientEntity
}
type ClientEntity ¶
type ClientEntity struct { ClientID string `json:"client_id" gorm:"uniqueIndex;not null;primaryKey"` ServerID string `json:"server_id"` TenantID int `json:"tenant_id" gorm:"not null"` UserID int `json:"user_id" gorm:"not null"` ConfigContent []byte `json:"config_content"` ConnectSecret string `json:"connect_secret" gorm:"not null"` Stopped bool `json:"stopped"` Comment string `json:"comment"` CreatedAt time.Time UpdatedAt time.Time DeletedAt gorm.DeletedAt `gorm:"index"` }
func (*ClientEntity) GetConfigContent ¶
func (c *ClientEntity) GetConfigContent() (*v1.ClientConfig, error)
func (*ClientEntity) SetConfigContent ¶
func (c *ClientEntity) SetConfigContent(cfg v1.ClientConfig) error
type DBManager ¶
type DBManager interface { GetDB(dbType string) *gorm.DB GetDefaultDB() *gorm.DB SetDB(dbType string, db *gorm.DB) RemoveDB(dbType string) Init() }
func GetDBManager ¶
func GetDBManager() DBManager
type Server ¶
type Server struct {
*ServerEntity
}
type ServerEntity ¶
type ServerEntity struct { ServerID string `json:"client_id" gorm:"uniqueIndex;not null;primaryKey"` TenantID int `json:"tenant_id" gorm:"not null"` UserID int `json:"user_id" gorm:"not null"` ServerIP string `json:"server_ip"` ConfigContent []byte `json:"config_content"` ConnectSecret string `json:"connect_secret" gorm:"not null"` Comment string `json:"comment"` CreatedAt time.Time UpdatedAt time.Time DeletedAt gorm.DeletedAt `gorm:"index"` }
func (*ServerEntity) GetConfigContent ¶
func (s *ServerEntity) GetConfigContent() (*v1.ServerConfig, error)
func (*ServerEntity) SetConfigContent ¶
func (s *ServerEntity) SetConfigContent(cfg *v1.ServerConfig) error
type User ¶
type User struct {
*UserEntity
}
type UserEntity ¶
type UserEntity struct { UserID int `json:"user_id" gorm:"primaryKey"` UserName string `json:"user_name" gorm:"uniqueIndex;not null"` Password string `json:"password"` Email string `json:"email" gorm:"uniqueIndex;not null"` Status int `json:"status"` Role string `json:"role"` TenantID int `json:"tenant_id"` Token string `json:"token"` CreatedAt time.Time UpdatedAt time.Time DeletedAt gorm.DeletedAt `gorm:"index"` }
func (*UserEntity) GetEmail ¶
func (u *UserEntity) GetEmail() string
func (*UserEntity) GetHashedPassword ¶
func (u *UserEntity) GetHashedPassword() string
func (*UserEntity) GetRole ¶
func (u *UserEntity) GetRole() string
func (*UserEntity) GetSafeUserInfo ¶
func (u *UserEntity) GetSafeUserInfo() UserEntity
func (*UserEntity) GetStatus ¶
func (u *UserEntity) GetStatus() int
func (*UserEntity) GetTenantID ¶
func (u *UserEntity) GetTenantID() int
func (*UserEntity) GetToken ¶
func (u *UserEntity) GetToken() string
func (*UserEntity) GetUserID ¶
func (u *UserEntity) GetUserID() int
func (*UserEntity) GetUserIDStr ¶
func (u *UserEntity) GetUserIDStr() string
func (*UserEntity) GetUserName ¶
func (u *UserEntity) GetUserName() string
func (*UserEntity) IsAdmin ¶
func (u *UserEntity) IsAdmin() bool
func (*UserEntity) Valid ¶
func (u *UserEntity) Valid() bool
Click to show internal directories.
Click to hide internal directories.