model

package
v0.0.0-...-7d1f1a1 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2021 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RoleUser  = SshRole("user")
	RoleAdmin = SshRole("admin")
)

Variables

This section is empty.

Functions

func CfgSyncDatabase

func CfgSyncDatabase(db *gorm.DB, res *CfgSchema) error

func CfgUpdate

func CfgUpdate(db *gorm.DB, arg *CfgModel) error

func LoadDatabase

func LoadDatabase(isTest bool) *gorm.DB

Types

type BaseModel

type BaseModel struct {
	Id        uint      `gorm:"primary_key" json:"id" form:"id"`
	CreatedAt time.Time `json:"cat"`
	UpdatedAt time.Time `json:"uat"`
}

type CfgModel

type CfgModel struct {
	Name  string `gorm:"primaryKey" json:"name"` //配置名称
	Value string `json:"value"`                  // 配置值
	Def   string `json:"def"`                    // 配置默认值
	Desc  string `json:"desc"`                   // 配置说明
}

func CfgList

func CfgList(db *gorm.DB) (list []CfgModel, err error)

type CfgSchema

type CfgSchema struct {
	Secret              string `desc:"APP secret 16/24/32长度" def:"uaz6225fFMTIwScSjRB842ujvQdlxyMS"`
	Version             string `desc:"版本号" def:"v0.0.1"`
	QiniuAk             string `desc:"七牛云AK" def:"xxx"`
	QiniuSk             string `desc:"七牛云SK" def:"sk"`
	QiniuBucket         string `desc:"七牛云Bucket" def:"mojocn"`
	QiniuBucketEndPoint string `desc:"七牛云Bucket endpoint" def:"https://s3.mojotv.cn"`
	TencentCloudAk      string `desc:"腾讯云AK" def:"-"`
	TencentCloudSk      string `desc:"腾讯云SK" def:"-"`
	AddrRpc             string `desc:"私有启动RPC服务地址,提供给sshd进行通讯和调用" def:"127.0.0.1:8099"`
	AddrWebSshd         string `desc:"私有启动sshd网页服务地址" def:"127.0.0.1:8025"`
	AddrWebUi           string `desc:"私有启动felix本地web管理地址" def:"127.0.0.1:8014"`
	AddrGuacamole       string `desc:"第三方guacamole gaucd服务启动的地址" def:"10.13.84.219:4822"`
}

type JsonArrayUint

type JsonArrayUint []uint

func (JsonArrayUint) AppendOrRemove

func (j JsonArrayUint) AppendOrRemove(e uint) (isExist bool, a JsonArrayUint)

func (JsonArrayUint) Equals

func (j JsonArrayUint) Equals(j1 JsonArrayUint) bool

func (JsonArrayUint) IsNull

func (j JsonArrayUint) IsNull() bool

func (JsonArrayUint) MarshalJSONArrayUint

func (m JsonArrayUint) MarshalJSONArrayUint() ([]byte, error)

func (*JsonArrayUint) Scan

func (o *JsonArrayUint) Scan(input interface{}) (err error)

func (*JsonArrayUint) UnmarshalJSONArrayUint

func (m *JsonArrayUint) UnmarshalJSONArrayUint(data []byte) error

func (JsonArrayUint) Value

func (o JsonArrayUint) Value() (driver.Value, error)

type Machine

type Machine struct {
	BaseModel
	Protocol           string `json:"protocol"` // ssh rdp vnc
	Name               string `json:"name"`
	Host               string `json:"host"`
	Ip                 string `json:"ip"`
	Port               int    `json:"port"`
	Remark             string `json:"remark"`
	User               string `json:"user"`
	Password           string `json:"password"`
	PrivateKey         string `json:"private_key"`
	PrivateKeyPassword string `json:"private_key_password"`
	WebSshURL          string `gorm:"-" json:"web_ssh_url"`
}

func MachineFrom

func MachineFrom(db *gorm.DB, secret string, key []byte) (ins *Machine, err error)

func MachineList

func MachineList(db *gorm.DB, q string) (list []Machine, err error)

func (*Machine) GenerateToken

func (m *Machine) GenerateToken(key []byte, expireIn time.Duration) (string, error)

func (Machine) ID

func (m Machine) ID() string

func (Machine) SshAddr

func (m Machine) SshAddr() string

type PaginationQ

type PaginationQ struct {
	Ok    bool        `json:"ok"`
	Size  int         `form:"size" json:"size"`
	Page  int         `form:"page" json:"page"`
	Data  interface{} `json:"data" comment:"muster be a pointer of slice gorm.Model"` // save pagination list
	Total int64       `json:"total"`
}

PaginationQ gin handler query binding struct

func (*PaginationQ) SearchAll

func (p *PaginationQ) SearchAll(queryTx *gorm.DB) (data *PaginationQ, err error)

SearchAll optimized pagination method for gorm

type SshRole

type SshRole string

type User

type User struct {
	BaseModel
	Role          string `json:"role"`
	RealName      string `json:"real_name"`
	Account       string `json:"account"`
	Avatar        string `json:"avatar"`
	Name          string `json:"name"`
	Email         string `json:"email"`
	Phone         string `json:"phone"`
	Password      string `json:"password"`
	Secret        string `json:"-"`
	GithubAccount string `json:"github_account"`
	PublicKey     string `json:"public_key"`
}

Jump to

Keyboard shortcuts

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