model

package
v1.12.2 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2022 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Fail = iota
	Success
)

state type

View Source
const (
	Disable = iota
	Enable
)

state type

View Source
const (
	PENDING = iota
	APPROVE
	DENY
)

review state type

View Source
const (
	ProjectNotDeploy = 0
	ProjectDeploying = 1
	ProjectSuccess   = 2
	ProjectFail      = 3
)

Project deploy state

View Source
const (
	ProjectManualDeploy  = 0
	ProjectWebhookDeploy = 1
)

Project deploy type

View Source
const (
	RepoGit  = "git"
	RepoSVN  = "svn"
	RepoFTP  = "ftp"
	RepoSFTP = "sftp"
)
View Source
const (
	NotifyWeiXin   = 1
	NotifyDingTalk = 2
	NotifyFeiShu   = 3
	NotifyCustom   = 255
)

Project notify type

View Source
const (
	NotRun = iota
	Run
)

state type

View Source
const (
	QUEUE = 0

	BeforePull = 1

	Pull = 2

	AfterPull = 3

	BeforeDeploy = 4

	Deploy = 5

	AfterDeploy = 6
)

publish trace state

View Source
const (
	SftpLogTypeDownload = "DOWNLOAD"
	SftpLogTypeUpload   = "UPLOAD"
	SftpLogTypeRead     = "READ"
	SftpLogTypePreview  = "PREVIEW"
	SftpLogTypeDelete   = "DELETE"
)
View Source
const (
	SuperManager = 1
	GeneralUser  = 0
)

user role

Variables

View Source
var DB *sql.DB

DB init when the program start

Functions

func CreateDB added in v1.6.0

func CreateDB(db *sql.DB, name string) error

func ImportSQL

func ImportSQL(db *sql.DB, sqlPath string) error

func Init

func Init()

Init DB

func Update added in v1.3.4

func Update(targetVerStr string) error

func UserDB added in v1.6.0

func UserDB(db *sql.DB, name string) error

Types

type Chart

type Chart struct {
	Hour         int `json:"hour"`
	CommitNumber int `json:"commitNumber"`
	DeployNumber int `json:"deployNumber"`
	FailNumber   int `json:"failNumber"`
	BackNumber   int `json:"backNumber"`
}

Chart struct

type Charts

type Charts []Chart

Charts struct

func (*Charts) Query

func (c *Charts) Query(date string) error

Query chart row

type Cron added in v1.4.0

type Cron struct {
	ID          int64  `json:"id"`
	ServerID    int64  `json:"serverId"`
	Expression  string `json:"expression"`
	Command     string `json:"command"`
	SingleMode  uint8  `json:"singleMode"`
	LogLevel    uint8  `json:"logLevel"`
	Description string `json:"description"`
	State       uint8  `json:"state"`
	Creator     string `json:"creator"`
	Editor      string `json:"editor"`
	InsertTime  string `json:"insertTime,omitempty"`
	UpdateTime  string `json:"updateTime,omitempty"`
}

func (Cron) AddRow added in v1.4.0

func (c Cron) AddRow() (int64, error)

func (Cron) EditRow added in v1.4.0

func (c Cron) EditRow() error

func (Cron) GetList added in v1.4.0

func (c Cron) GetList() (Crons, error)

func (Cron) RemoveRow added in v1.4.0

func (c Cron) RemoveRow() error

type CronLog added in v1.4.0

type CronLog struct {
	ID         int64  `json:"id"`
	CronID     int64  `json:"cronId"`
	ServerID   int64  `json:"serverId"`
	ExecCode   int    `json:"execCode"`
	Message    string `json:"message"`
	ReportTime string `json:"reportTime"`
	InsertTime string `json:"insertTime"`
}

CronLog -

func (CronLog) AddRow added in v1.4.0

func (cl CronLog) AddRow() error

AddRow -

func (CronLog) GetList added in v1.4.0

func (cl CronLog) GetList(page, limit uint64) (CronLogs, error)

GetList -

type CronLogs added in v1.4.0

type CronLogs []CronLog

CronLogs -

type Crons added in v1.4.0

type Crons []Cron

type Crontab

type Crontab struct {
	ID          int64  `json:"id"`
	ServerID    int64  `json:"serverId"`
	Expression  string `json:"expression"`
	Description string `json:"description"`
	Save        uint8  `json:"save"`
	State       uint8  `json:"state"`
	InsertTime  string `json:"insertTime,omitempty"`
	UpdateTime  string `json:"updateTime,omitempty"`
}

func (Crontab) AddRow

func (c Crontab) AddRow() (int64, error)

func (Crontab) EditRow

func (c Crontab) EditRow() error

func (Crontab) GetList

func (c Crontab) GetList() (Crontabs, error)

func (Crontab) RemoveRow added in v1.12.2

func (c Crontab) RemoveRow() error

type Crontabs

type Crontabs []Crontab

type LoginLog added in v1.4.6

type LoginLog struct {
	ID         int64  `json:"id"`
	Account    string `json:"account"`
	RemoteAddr string `json:"remoteAddr"`
	UserAgent  string `json:"userAgent"`
	Referer    string `json:"referer"`
	Reason     string `json:"reason"`
	LoginTime  string `json:"loginTime"`
}

func (LoginLog) AddRow added in v1.4.6

func (ll LoginLog) AddRow() error

func (LoginLog) GetList added in v1.4.6

func (ll LoginLog) GetList(page, limit uint64) (LoginLogs, error)

func (LoginLog) GetTotal added in v1.4.6

func (ll LoginLog) GetTotal() (int64, error)

type LoginLogs added in v1.4.6

type LoginLogs []LoginLog

type Monitor

type Monitor struct {
	ID           int64  `json:"id"`
	NamespaceID  int64  `json:"namespaceId"`
	Name         string `json:"name"`
	Type         int    `json:"type"`
	Target       string `json:"target"`
	Second       int    `json:"second"`
	Times        uint16 `json:"times"`
	SilentCycle  int    `json:"silentCycle"`
	NotifyType   uint8  `json:"notifyType"`
	NotifyTarget string `json:"notifyTarget"`
	Description  string `json:"description"`
	ErrorContent string `json:"errorContent"`
	State        uint8  `json:"state"`
	InsertTime   string `json:"insertTime"`
	UpdateTime   string `json:"updateTime"`
}

func (Monitor) AddRow

func (m Monitor) AddRow() (int64, error)

func (Monitor) DeleteRow

func (m Monitor) DeleteRow() error

func (Monitor) EditRow

func (m Monitor) EditRow() error

func (Monitor) GetAllByState

func (m Monitor) GetAllByState() (Monitors, error)

func (Monitor) GetData

func (m Monitor) GetData() (Monitor, error)

func (Monitor) GetList

func (m Monitor) GetList() (Monitors, error)

func (Monitor) Notify added in v1.3.8

func (m Monitor) Notify(errMsg string) (string, error)

func (Monitor) ToggleState

func (m Monitor) ToggleState() error

func (Monitor) TurnOff added in v1.0.3

func (m Monitor) TurnOff(errorContent string) error

type Monitors

type Monitors []Monitor

type Namespace

type Namespace struct {
	ID            int64   `json:"id"`
	Name          string  `json:"name"`
	UserID        int64   `json:"-"`
	RoleID        int64   `json:"role_id"`
	PermissionIDs []int64 `json:"permissionIds"`
	InsertTime    string  `json:"insertTime,omitempty"`
	UpdateTime    string  `json:"updateTime,omitempty"`
}

func (Namespace) AddRow

func (ns Namespace) AddRow() (int64, error)

func (Namespace) EditRow

func (ns Namespace) EditRow() error

func (Namespace) GetAllByUserID

func (ns Namespace) GetAllByUserID() (Namespaces, error)

func (Namespace) GetData

func (ns Namespace) GetData() (Namespace, error)

func (Namespace) GetList added in v1.6.0

func (ns Namespace) GetList() (Namespaces, error)

type NamespaceUser

type NamespaceUser struct {
	ID            int64              `json:"id,omitempty"`
	NamespaceID   int64              `json:"namespaceId,omitempty"`
	NamespaceName string             `json:"namespaceName,omitempty"`
	UserID        int64              `json:"userId,omitempty"`
	UserName      string             `json:"userName,omitempty"`
	RoleID        int64              `json:"roleId,omitempty"`
	RoleName      string             `json:"roleName,omitempty"`
	PermissionIDs map[int64]struct{} `json:"permissionIds,omitempty"`
	InsertTime    string             `json:"insertTime,omitempty"`
	UpdateTime    string             `json:"updateTime,omitempty"`
}

NamespaceUser -

func (NamespaceUser) AddAdminByNamespaceID

func (nu NamespaceUser) AddAdminByNamespaceID() error

func (NamespaceUser) AddAdminByUserID

func (nu NamespaceUser) AddAdminByUserID() error

func (NamespaceUser) DeleteByUserID

func (nu NamespaceUser) DeleteByUserID() error

func (NamespaceUser) DeleteRow

func (nu NamespaceUser) DeleteRow() error

func (NamespaceUser) GetAllUserByNamespaceID

func (nu NamespaceUser) GetAllUserByNamespaceID() (NamespaceUsers, error)

func (NamespaceUser) GetBindUserListByNamespaceID

func (nu NamespaceUser) GetBindUserListByNamespaceID() (NamespaceUsers, error)

func (NamespaceUser) GetDataByRoleID added in v1.6.0

func (nu NamespaceUser) GetDataByRoleID() (NamespaceUser, error)

func (NamespaceUser) GetDataByUserNamespace added in v1.6.0

func (nu NamespaceUser) GetDataByUserNamespace() (NamespaceUser, error)

func (NamespaceUser) GetUserNamespaceList added in v1.4.6

func (nu NamespaceUser) GetUserNamespaceList() (NamespaceUsers, error)

type NamespaceUsers

type NamespaceUsers []NamespaceUser

NamespaceUsers -

func (NamespaceUsers) AddMany

func (nu NamespaceUsers) AddMany() error

type Namespaces

type Namespaces []Namespace

type OperationLog added in v1.11.0

type OperationLog struct {
	ID           int64  `json:"id"`
	NamespaceID  int64  `json:"namespaceID"`
	UserID       int64  `json:"userID"`
	Username     string `json:"username"`
	Router       string `json:"router"`
	API          string `json:"api"`
	RequestTime  string `json:"requestTime"`
	RequestData  string `json:"requestData"`
	ResponseTime string `json:"responseTime"`
	ResponseData string `json:"responseData"`
}

func (OperationLog) AddRow added in v1.11.0

func (ol OperationLog) AddRow() error

func (OperationLog) GetList added in v1.11.0

func (ol OperationLog) GetList(page, limit uint64) (OperationLogs, error)

func (OperationLog) GetTotal added in v1.11.0

func (ol OperationLog) GetTotal() (int64, error)

type OperationLogs added in v1.11.0

type OperationLogs []OperationLog

type Pagination

type Pagination struct {
	Page  uint64 `json:"page" schema:"page"`
	Rows  uint64 `json:"rows" schema:"rows"`
	Total uint64 `json:"total" schema:"total"`
}

Pagination struct

func PaginationFrom

func PaginationFrom(param url.Values) (Pagination, error)

PaginationFrom param return pagination struct

type Permission added in v1.6.0

type Permission struct {
	ID          int64  `json:"id"`
	PID         int64  `json:"pid"`
	Name        string `json:"name"`
	Sort        int    `json:"sort"`
	Description string `json:"description"`
	InsertTime  string `json:"insertTime,omitempty"`
	UpdateTime  string `json:"updateTime,omitempty"`
}

func (Permission) GetIDs added in v1.6.0

func (p Permission) GetIDs() (map[int64]struct{}, error)

func (Permission) GetList added in v1.6.0

func (p Permission) GetList() (Permissions, error)

type Permissions added in v1.6.0

type Permissions []Permission

type Project

type Project struct {
	ID                    int64  `json:"id"`
	NamespaceID           int64  `json:"namespaceId"`
	UserID                int64  `json:"userId,omitempty"`
	RepoType              string `json:"repoType"`
	Name                  string `json:"name"`
	URL                   string `json:"url"`
	Path                  string `json:"path"`
	Environment           uint8  `json:"environment"`
	Branch                string `json:"branch"`
	SymlinkPath           string `json:"symlinkPath"`
	SymlinkBackupNumber   uint8  `json:"symlinkBackupNumber"`
	Review                uint8  `json:"review"`
	ReviewURL             string `json:"reviewURL"`
	AfterPullScriptMode   string `json:"afterPullScriptMode"`
	AfterPullScript       string `json:"afterPullScript"`
	AfterDeployScriptMode string `json:"afterDeployScriptMode"`
	AfterDeployScript     string `json:"afterDeployScript"`
	TransferType          string `json:"transferType"`
	TransferOption        string `json:"transferOption"`
	DeployServerMode      string `json:"deployServerMode"`
	AutoDeploy            uint8  `json:"autoDeploy"`
	PublisherID           int64  `json:"publisherId"`
	PublisherName         string `json:"publisherName"`
	PublishExt            string `json:"publishExt"`
	DeployState           uint8  `json:"deployState"`
	LastPublishToken      string `json:"lastPublishToken"`
	NotifyType            uint8  `json:"notifyType"`
	NotifyTarget          string `json:"notifyTarget"`
	State                 uint8  `json:"state"`
	InsertTime            string `json:"insertTime"`
	UpdateTime            string `json:"updateTime"`
}

func (Project) AddRow

func (p Project) AddRow() (int64, error)

func (Project) DeployFail

func (p Project) DeployFail() error

DeployFail set deploy_state to fail

func (Project) DeploySuccess

func (p Project) DeploySuccess() error

DeploySuccess set deploy_state to success

func (Project) EditRow

func (p Project) EditRow() error

func (Project) GetData

func (p Project) GetData() (Project, error)

func (Project) GetDeployList added in v1.6.0

func (p Project) GetDeployList() (Projects, error)

func (Project) GetList

func (p Project) GetList() (Projects, error)

func (Project) GetUserProjectData

func (p Project) GetUserProjectData() (Project, error)

func (Project) Publish

func (p Project) Publish() error

func (Project) RemoveRow

func (p Project) RemoveRow() error

func (Project) ResetState added in v1.0.7

func (p Project) ResetState() error

ResetState set deploy_state to NotDeploy

func (Project) SetAutoDeploy added in v1.0.2

func (p Project) SetAutoDeploy() error

type ProjectFile added in v1.1.3

type ProjectFile struct {
	ID         int64  `json:"id"`
	ProjectID  int64  `json:"projectId"`
	Filename   string `json:"filename"`
	InsertTime string `json:"insertTime"`
	UpdateTime string `json:"updateTime"`
}

ProjectFile -

func (ProjectFile) AddRow added in v1.1.3

func (pf ProjectFile) AddRow() (int64, error)

AddRow return LastInsertId

func (ProjectFile) DeleteRow added in v1.1.3

func (pf ProjectFile) DeleteRow() error

DeleteRow -

func (ProjectFile) EditRow added in v1.1.3

func (pf ProjectFile) EditRow() error

EditRow -

func (ProjectFile) GetData added in v1.1.3

func (pf ProjectFile) GetData() (ProjectFile, error)

GetData -

func (ProjectFile) GetListByProjectID added in v1.1.3

func (pf ProjectFile) GetListByProjectID() (ProjectFiles, error)

GetListByProjectID -

func (ProjectFile) GetTotalByProjectID added in v1.1.3

func (pf ProjectFile) GetTotalByProjectID() (int64, error)

GetTotalByProjectID -

type ProjectFiles added in v1.1.3

type ProjectFiles []ProjectFile

ProjectFiles -

type ProjectProcess added in v1.4.4

type ProjectProcess struct {
	ID         int64  `json:"id"`
	ProjectID  int64  `json:"projectId"`
	Name       string `json:"name"`
	Start      string `json:"start"`
	Stop       string `json:"stop"`
	Status     string `json:"status"`
	Restart    string `json:"restart"`
	InsertTime string `json:"insertTime,omitempty"`
	UpdateTime string `json:"updateTime,omitempty"`
}

func (ProjectProcess) AddRow added in v1.4.4

func (pp ProjectProcess) AddRow() (int64, error)

func (ProjectProcess) DeleteRow added in v1.4.4

func (pp ProjectProcess) DeleteRow() error

func (ProjectProcess) EditRow added in v1.4.4

func (pp ProjectProcess) EditRow() error

func (ProjectProcess) GetData added in v1.4.4

func (pp ProjectProcess) GetData() (ProjectProcess, error)

GetData -

func (ProjectProcess) GetListByProjectID added in v1.4.4

func (pp ProjectProcess) GetListByProjectID(page, limit uint64) (ProjectProcesses, error)

type ProjectProcesses added in v1.4.4

type ProjectProcesses []ProjectProcess

type ProjectReview added in v1.0.4

type ProjectReview struct {
	ID         int64  `json:"id"`
	ProjectID  int64  `json:"projectId"`
	CommitID   string `json:"commitId"`
	Branch     string `json:"branch"`
	ReviewURL  string `json:"reviewURL"`
	State      uint8  `json:"state"`
	Creator    string `json:"creator"`
	CreatorID  int64  `json:"creatorId"`
	Editor     string `json:"editor"`
	EditorID   int64  `json:"editorId"`
	InsertTime string `json:"insertTime"`
	UpdateTime string `json:"updateTime"`
}

ProjectReview -

func (ProjectReview) AddRow added in v1.0.4

func (pr ProjectReview) AddRow() (int64, error)

AddRow -

func (ProjectReview) EditRow added in v1.0.4

func (pr ProjectReview) EditRow() error

EditRow -

func (ProjectReview) GetData added in v1.0.4

func (pr ProjectReview) GetData() (ProjectReview, error)

GetData -

func (ProjectReview) GetListByProjectID added in v1.0.4

func (pr ProjectReview) GetListByProjectID(pagination Pagination) (ProjectReviews, Pagination, error)

GetListByProjectID -

type ProjectReviews added in v1.0.4

type ProjectReviews []ProjectReview

ProjectReviews -

type ProjectServer

type ProjectServer struct {
	ID                 int64  `json:"id"`
	ProjectID          int64  `json:"projectId"`
	ServerID           int64  `json:"serverId"`
	ServerName         string `json:"serverName"`
	ServerOS           string `json:"serverOS"`
	ServerIP           string `json:"serverIP"`
	ServerPort         int    `json:"serverPort"`
	ServerOwner        string `json:"serverOwner"`
	ServerPassword     string `json:"serverPassword"`
	ServerPath         string `json:"serverPath"`
	ServerJumpIP       string `json:"serverJumpIP"`
	ServerJumpPort     int    `json:"serverJumpPort"`
	ServerJumpOwner    string `json:"serverJumpOwner"`
	ServerJumpPassword string `json:"serverJumpPassword"`
	ServerJumpPath     string `json:"serverJumpPath"`
	ServerDescription  string `json:"serverDescription"`
	InsertTime         string `json:"insertTime"`
	UpdateTime         string `json:"updateTime"`
}

func (ProjectServer) DeleteByProjectID added in v1.5.0

func (ps ProjectServer) DeleteByProjectID() error

func (ProjectServer) DeleteRow

func (ps ProjectServer) DeleteRow() error

func (ProjectServer) GetBindServerListByProjectID

func (ps ProjectServer) GetBindServerListByProjectID() (ProjectServers, error)

func (ProjectServer) ToSSHConfig added in v1.7.1

func (ps ProjectServer) ToSSHConfig() utils.SSHConfig

func (ProjectServer) ToSSHOption added in v1.7.1

func (ps ProjectServer) ToSSHOption() string

type ProjectServers

type ProjectServers []ProjectServer

func (ProjectServers) AddMany

func (ps ProjectServers) AddMany() error

type ProjectTask

type ProjectTask struct {
	ID         int64  `json:"id"`
	ProjectID  int64  `json:"projectId"`
	Branch     string `json:"branch"`
	CommitID   string `json:"commit"`
	Date       string `json:"date"`
	State      uint8  `json:"state"`
	IsRun      uint8  `json:"isRun"`
	Creator    string `json:"creator"`
	CreatorID  int64  `json:"creatorId"`
	Editor     string `json:"editor"`
	EditorID   int64  `json:"editorId"`
	InsertTime string `json:"insertTime"`
	UpdateTime string `json:"updateTime"`
}

ProjectTask -

func (ProjectTask) AddRow

func (pt ProjectTask) AddRow() (int64, error)

AddRow -

func (ProjectTask) GetListByProjectID

func (pt ProjectTask) GetListByProjectID(pagination Pagination) (ProjectTasks, Pagination, error)

GetListByProjectID -

func (ProjectTask) GetNotRunListLTDate

func (pt ProjectTask) GetNotRunListLTDate(date string) (ProjectTasks, error)

GetNotRunListLTDate -

func (ProjectTask) RemoveRow

func (pt ProjectTask) RemoveRow() error

RemoveRow -

func (ProjectTask) SetRun

func (pt ProjectTask) SetRun() error

SetRun set project task to run

type ProjectTasks

type ProjectTasks []ProjectTask

ProjectTasks -

type ProjectUser

type ProjectUser struct {
	ID          int64  `json:"id"`
	NamespaceID int64  `json:"namespaceId,omitempty"`
	ProjectID   int64  `json:"projectId"`
	ProjectName string `json:"projectName"`
	UserID      int64  `json:"userId"`
	UserName    string `json:"userName"`
	InsertTime  string `json:"insertTime"`
	UpdateTime  string `json:"updateTime"`
}

func (ProjectUser) AddAdminByUserID

func (pu ProjectUser) AddAdminByUserID() error

AddAdminByUserID add admin to table project_user

func (ProjectUser) AddNamespaceProjectInUserID

func (pu ProjectUser) AddNamespaceProjectInUserID(namespaceID int64, userIDs []int64) error

AddNamespaceProjectInUserID add all project with namespace in user id

func (ProjectUser) DeleteByProjectID added in v1.5.0

func (pu ProjectUser) DeleteByProjectID() error

func (ProjectUser) DeleteByUserID

func (pu ProjectUser) DeleteByUserID() error

func (ProjectUser) DeleteRow

func (pu ProjectUser) DeleteRow() error

func (ProjectUser) GetBindUserListByProjectID

func (pu ProjectUser) GetBindUserListByProjectID() (ProjectUsers, error)

type ProjectUsers

type ProjectUsers []ProjectUser

func (ProjectUsers) AddMany

func (pu ProjectUsers) AddMany() error

type Projects

type Projects []Project

type PublishTrace

type PublishTrace struct {
	ID            int64  `json:"id"`
	Token         string `json:"token"`
	NamespaceID   int64  `json:"namespaceId"`
	ProjectID     int64  `json:"projectId"`
	ProjectName   string `json:"projectName"`
	Detail        string `json:"detail"`
	State         int    `json:"state"`
	PublisherID   int64  `json:"publisherId"`
	PublisherName string `json:"publisherName"`
	Type          int    `json:"type"`
	Ext           string `json:"ext"`
	InsertTime    string `json:"insertTime"`
	UpdateTime    string `json:"updateTime"`
}

PublishTrace -

func (PublishTrace) AddRow

func (pt PublishTrace) AddRow() (int64, error)

AddRow return LastInsertId

func (PublishTrace) EditUpdateTimeByToken added in v1.1.6

func (pt PublishTrace) EditUpdateTimeByToken() error

EditUpdateTimeByToken -

func (PublishTrace) GetDetail added in v1.1.2

func (pt PublishTrace) GetDetail() (string, error)

func (PublishTrace) GetList added in v1.4.6

func (pt PublishTrace) GetList(page, limit uint64) (PublishTraces, error)

func (PublishTrace) GetListByToken

func (pt PublishTrace) GetListByToken() (PublishTraces, error)

func (PublishTrace) GetPreview

func (pt PublishTrace) GetPreview(
	branch string,
	commit string,
	filename string,
	commitDate []string,
	deployDate []string,
	pagination Pagination,
) (PublishTraces, Pagination, error)

func (PublishTrace) GetTotal added in v1.4.6

func (pt PublishTrace) GetTotal() (int64, error)

type PublishTraces

type PublishTraces []PublishTrace

PublishTraces -

type Role added in v1.6.0

type Role struct {
	ID          int64  `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
	InsertTime  string `json:"insertTime,omitempty"`
	UpdateTime  string `json:"updateTime,omitempty"`
}

func (Role) AddRow added in v1.6.0

func (r Role) AddRow() (int64, error)

func (Role) DeleteRow added in v1.6.0

func (r Role) DeleteRow() error

func (Role) EditRow added in v1.6.0

func (r Role) EditRow() error

func (Role) GetAll added in v1.6.0

func (r Role) GetAll() (Roles, error)

func (Role) GetData added in v1.6.0

func (r Role) GetData() (Role, error)

func (Role) GetList added in v1.6.0

func (r Role) GetList() (Roles, error)

type RolePermission added in v1.6.0

type RolePermission struct {
	ID           int64  `json:"id"`
	RoleID       int64  `json:"roleId"`
	PermissionID int64  `json:"permissionId"`
	InsertTime   string `json:"insertTime,omitempty"`
	UpdateTime   string `json:"updateTime,omitempty"`
}

func (RolePermission) DeleteByRoleID added in v1.6.0

func (rp RolePermission) DeleteByRoleID() error

func (RolePermission) GetData added in v1.6.0

func (rp RolePermission) GetData() (RolePermission, error)

func (RolePermission) GetList added in v1.6.0

func (rp RolePermission) GetList() (RolePermissions, error)

type RolePermissions added in v1.6.0

type RolePermissions []RolePermission

func (RolePermissions) AddMany added in v1.6.0

func (rps RolePermissions) AddMany() error

type Roles added in v1.6.0

type Roles []Role

type Server

type Server struct {
	ID           int64  `json:"id"`
	Name         string `json:"name"`
	IP           string `json:"ip"`
	Port         int    `json:"port"`
	Owner        string `json:"owner"`
	Path         string `json:"path"`
	Password     string `json:"password"`
	JumpIP       string `json:"jumpIP"`
	JumpPort     int    `json:"jumpPort"`
	JumpOwner    string `json:"jumpOwner"`
	JumpPath     string `json:"jumpPath"`
	JumpPassword string `json:"jumpPassword"`
	NamespaceID  int64  `json:"namespaceId"`
	Description  string `json:"description"`
	OS           string `json:"os"`
	OSInfo       string `json:"osInfo"`
	State        int8   `json:"state"`
	InsertTime   string `json:"insertTime"`
	UpdateTime   string `json:"updateTime"`
}

func (Server) AddRow

func (s Server) AddRow() (int64, error)

AddRow return LastInsertId

func (Server) EditRow

func (s Server) EditRow() error

EditRow -

func (Server) GetAll

func (s Server) GetAll() (Servers, error)

func (Server) GetData

func (s Server) GetData() (Server, error)

func (Server) GetList

func (s Server) GetList() (Servers, error)

func (Server) ToSSHConfig added in v1.7.0

func (s Server) ToSSHConfig() utils.SSHConfig

func (Server) ToggleRow added in v1.3.1

func (s Server) ToggleRow() error

ToggleRow -

type ServerAgentLog added in v1.3.7

type ServerAgentLog struct {
	ServerID   int64  `json:"serverId,omitempty"`
	Type       int    `json:"type,omitempty"`
	Item       string `json:"item"`
	Value      string `json:"value"`
	ReportTime string `json:"reportTime"`
}

ServerAgentLog -

func (ServerAgentLog) AddRow added in v1.3.7

func (sal ServerAgentLog) AddRow() error

AddRow return LastInsertId

func (ServerAgentLog) GetCycleValue added in v1.3.8

func (sal ServerAgentLog) GetCycleValue(groupCycle int, formula string) (value string, err error)

GetCycleValue -

func (ServerAgentLog) GetListBetweenTime added in v1.3.7

func (sal ServerAgentLog) GetListBetweenTime(low, high string) (ServerAgentLogs, error)

GetListBetweenTime -

type ServerAgentLogs added in v1.3.7

type ServerAgentLogs []ServerAgentLog

ServerAgentLogs -

type ServerMonitor added in v1.3.8

type ServerMonitor struct {
	ID           int64  `json:"id"`
	ServerID     int64  `json:"serverId"`
	Item         string `json:"item"`
	Formula      string `json:"formula"`
	Operator     string `json:"operator"`
	Value        string `json:"value"`
	GroupCycle   int    `json:"groupCycle"`
	LastCycle    int    `json:"lastCycle"`
	SilentCycle  int    `json:"silentCycle"`
	StartTime    string `json:"startTime"`
	EndTime      string `json:"endTime"`
	NotifyType   uint8  `json:"notifyType"`
	NotifyTarget string `json:"notifyTarget"`
	InsertTime   string `json:"insertTime"`
	UpdateTime   string `json:"updateTime"`
}

ServerMonitor -

func (ServerMonitor) AddRow added in v1.3.8

func (sm ServerMonitor) AddRow() (int64, error)

AddRow return LastInsertId

func (ServerMonitor) DeleteRow added in v1.3.8

func (sm ServerMonitor) DeleteRow() error

DeleteRow -

func (ServerMonitor) EditRow added in v1.3.8

func (sm ServerMonitor) EditRow() error

EditRow -

func (ServerMonitor) GetAll added in v1.3.8

func (sm ServerMonitor) GetAll() (ServerMonitors, error)

GetAll -

func (ServerMonitor) GetAllModBy added in v1.3.8

func (sm ServerMonitor) GetAllModBy(number int, time string) (ServerMonitors, error)

GetAllModBy -

func (ServerMonitor) Notify added in v1.3.8

func (sm ServerMonitor) Notify(server Server, cycleValue string) (string, error)

type ServerMonitors added in v1.3.8

type ServerMonitors []ServerMonitor

ServerMonitors -

type ServerProcess added in v1.10.0

type ServerProcess struct {
	ID          int64  `json:"id"`
	NamespaceID int64  `json:"namespaceId"`
	Name        string `json:"name"`
	Items       string `json:"items"`
	InsertTime  string `json:"insertTime,omitempty"`
	UpdateTime  string `json:"updateTime,omitempty"`
}

func (ServerProcess) AddRow added in v1.10.0

func (sp ServerProcess) AddRow() (int64, error)

func (ServerProcess) DeleteRow added in v1.10.0

func (sp ServerProcess) DeleteRow() error

func (ServerProcess) EditRow added in v1.10.0

func (sp ServerProcess) EditRow() error

func (ServerProcess) GetData added in v1.10.0

func (sp ServerProcess) GetData() (ServerProcess, error)

func (ServerProcess) GetList added in v1.12.0

func (sp ServerProcess) GetList() (ServerProcesses, error)

type ServerProcessItem added in v1.12.0

type ServerProcessItem struct {
	Name    string
	Command string
}

type ServerProcessItems added in v1.12.0

type ServerProcessItems []ServerProcessItem

type ServerProcesses added in v1.10.0

type ServerProcesses []ServerProcess

type Servers

type Servers []Server

type SftpLog added in v1.4.6

type SftpLog struct {
	ID          int64  `json:"id"`
	NamespaceID int64  `json:"namespaceID"`
	UserID      int64  `json:"userID"`
	Username    string `json:"username"`
	ServerID    int64  `json:"serverID"`
	ServerName  string `json:"serverName"`
	RemoteAddr  string `json:"remoteAddr"`
	UserAgent   string `json:"userAgent"`
	Type        string `json:"type"`
	Path        string `json:"path"`
	Reason      string `json:"reason"`
	InsertTime  string `json:"insertTime"`
	UpdateTime  string `json:"updateTime"`
}

func (SftpLog) AddRow added in v1.4.6

func (sl SftpLog) AddRow() error

func (SftpLog) GetList added in v1.4.6

func (sl SftpLog) GetList(page, limit uint64) (SftpLogs, error)

func (SftpLog) GetTotal added in v1.4.6

func (sl SftpLog) GetTotal() (int64, error)

type SftpLogs added in v1.4.6

type SftpLogs []SftpLog

type SystemConfig added in v1.3.4

type SystemConfig struct {
	ID    int64  `json:"id"`
	Key   string `json:"key"`
	Value string `json:"value"`
}

SystemConfig -

func (SystemConfig) EditRowByKey added in v1.3.4

func (sc SystemConfig) EditRowByKey() error

EditRowByKey -

func (SystemConfig) GetDataByKey added in v1.3.4

func (sc SystemConfig) GetDataByKey() (SystemConfig, error)

GetDataByKey -

type TerminalLog added in v1.4.6

type TerminalLog struct {
	ID          int64  `json:"id"`
	NamespaceID int64  `json:"namespaceID"`
	UserID      int64  `json:"userID"`
	Username    string `json:"username"`
	ServerID    int64  `json:"serverID"`
	ServerName  string `json:"serverName"`
	RemoteAddr  string `json:"remoteAddr"`
	UserAgent   string `json:"userAgent"`
	StartTime   string `json:"startTime"`
	EndTime     string `json:"endTime"`
	InsertTime  string `json:"insertTime"`
	UpdateTime  string `json:"updateTime"`
}

func (TerminalLog) AddRow added in v1.4.6

func (tl TerminalLog) AddRow() (int64, error)

func (TerminalLog) EditRow added in v1.4.6

func (tl TerminalLog) EditRow() error

func (TerminalLog) GetData added in v1.4.6

func (tl TerminalLog) GetData() (TerminalLog, error)

func (TerminalLog) GetList added in v1.4.6

func (tl TerminalLog) GetList(page, limit uint64) (TerminalLogs, error)

func (TerminalLog) GetTotal added in v1.4.6

func (tl TerminalLog) GetTotal() (int64, error)

type TerminalLogs added in v1.4.6

type TerminalLogs []TerminalLog

type User

type User struct {
	ID            int64  `json:"id"`
	Account       string `json:"account"`
	Password      string `json:"password"`
	Name          string `json:"name"`
	Contact       string `json:"contact"`
	SuperManager  int64  `json:"superManager"`
	State         uint8  `json:"state"`
	InsertTime    string `json:"insertTime"`
	UpdateTime    string `json:"updateTime"`
	LastLoginTime string `json:"lastLoginTime"`
}

User -

func (User) AddRow

func (u User) AddRow() (int64, error)

func (User) CreateToken

func (u User) CreateToken() (string, error)

CreateToken -

func (User) EditRow

func (u User) EditRow() error

EditRow -

func (User) GetAll

func (u User) GetAll() (Users, error)

func (User) GetData

func (u User) GetData() (User, error)

GetData -

func (User) GetDataByAccount

func (u User) GetDataByAccount() (User, error)

GetDataByAccount -

func (User) GetList

func (u User) GetList() (Users, error)

GetList -

func (User) GetTotal

func (u User) GetTotal() (int64, error)

func (User) RemoveRow

func (u User) RemoveRow() error

RemoveRow -

func (User) UpdateLastLoginTime

func (u User) UpdateLastLoginTime() error

UpdateLastLoginTime -

func (User) UpdatePassword

func (u User) UpdatePassword() error

UpdatePassword -

func (User) Validate

func (u User) Validate(inputPassword string) error

Validate if user exists

type Users

type Users []User

Users -

Jump to

Keyboard shortcuts

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