Documentation
¶
Index ¶
- Constants
- Variables
- func ImportSQL(db *sql.DB) error
- func Init()
- type Chart
- type Charts
- type Crontab
- func (c Crontab) AddRow() (int64, error)
- func (c Crontab) AddRowsInCommand(commands []string) error
- func (c Crontab) DeleteRow() error
- func (c Crontab) EditRow() error
- func (c Crontab) GetAllInCommandMD5(commandMD5s []string) (Crontabs, error)
- func (c Crontab) GetData() (Crontab, error)
- func (c Crontab) GetList(pagination Pagination) (Crontabs, error)
- func (c Crontab) GetTotal() (int64, error)
- type CrontabServer
- type CrontabServers
- type Crontabs
- type InstallTrace
- type InstallTraces
- type Monitor
- func (m Monitor) AddRow() (int64, error)
- func (m Monitor) DeleteRow() error
- func (m Monitor) EditRow() error
- func (m Monitor) GetAllByState() (Monitors, error)
- func (m Monitor) GetData() (Monitor, error)
- func (m Monitor) GetList(pagination Pagination) (Monitors, error)
- func (m Monitor) GetTotal() (int64, error)
- func (m Monitor) ToggleState() error
- func (m Monitor) TurnOff(errorContent string) error
- type Monitors
- type Namespace
- func (ns Namespace) AddRow() (int64, error)
- func (ns Namespace) EditRow() error
- func (ns Namespace) GetAllByUserID() (Namespaces, error)
- func (ns Namespace) GetData() (Namespace, error)
- func (ns Namespace) GetListByUserID(pagination Pagination) (Namespaces, error)
- func (ns Namespace) GetTotalByUserID() (int64, error)
- type NamespaceUser
- func (nu NamespaceUser) AddAdminByNamespaceID() error
- func (nu NamespaceUser) AddAdminByUserID() error
- func (nu NamespaceUser) DeleteByUserID() error
- func (nu NamespaceUser) DeleteRow() error
- func (nu NamespaceUser) GetAllGteManagerByNamespaceID() (NamespaceUsers, error)
- func (nu NamespaceUser) GetAllUserByNamespaceID() (NamespaceUsers, error)
- func (nu NamespaceUser) GetBindUserListByNamespaceID() (NamespaceUsers, error)
- type NamespaceUsers
- type Namespaces
- type Package
- func (p Package) AddRow() (int64, error)
- func (p Package) EditRow() error
- func (p Package) GetAll() (Packages, error)
- func (p Package) GetAllInID(IDs []string) (Packages, error)
- func (p Package) GetData() (Package, error)
- func (p Package) GetDataByName() (Package, error)
- func (p Package) GetList(pagination Pagination) (Packages, error)
- func (p Package) GetTotal() (int64, error)
- type Packages
- type Pagination
- type Project
- func (p Project) AddRow() (int64, error)
- func (p Project) DeployFail() error
- func (p Project) DeploySuccess() error
- func (p Project) EditRow() error
- func (p Project) GetData() (Project, error)
- func (p Project) GetList(pagination Pagination) (Projects, error)
- func (p Project) GetTotal() (int64, error)
- func (p Project) GetUserProjectData() (Project, error)
- func (p Project) GetUserProjectList() (Projects, error)
- func (p Project) Publish() error
- func (p Project) RemoveRow() error
- func (p Project) ResetState() error
- func (p Project) SetAutoDeploy() error
- type ProjectReview
- type ProjectReviews
- type ProjectServer
- type ProjectServers
- type ProjectTask
- type ProjectTasks
- type ProjectUser
- type ProjectUsers
- type Projects
- type PublishTrace
- type PublishTraces
- type Server
- func (s Server) AddRow() (int64, error)
- func (s Server) EditRow() error
- func (s Server) GetAll() (Servers, error)
- func (s Server) GetData() (Server, error)
- func (s Server) GetList(pagination Pagination) (Servers, error)
- func (s Server) GetTotal() (int64, error)
- func (s Server) Install() error
- func (s Server) RemoveRow() error
- type Servers
- type Template
- func (tpl Template) AddRow() (int64, error)
- func (tpl Template) DeleteRow() error
- func (tpl Template) EditRow() error
- func (tpl Template) GetAll() (Templates, error)
- func (tpl Template) GetData() (Template, error)
- func (tpl Template) GetList(pagination Pagination) (Templates, error)
- func (tpl Template) GetTotal() (int64, error)
- type Templates
- type User
- func (u User) AddRow() (int64, error)
- func (u User) CreateToken() (string, error)
- func (u User) EditRow() error
- func (u User) GetAll() (Users, error)
- func (u User) GetData() (User, error)
- func (u User) GetDataByAccount() (User, error)
- func (u User) GetList(pagination Pagination) (Users, error)
- func (u User) GetTotal() (int64, error)
- func (u User) RemoveRow() error
- func (u User) UpdateLastLoginTime() error
- func (u User) UpdatePassword() error
- func (u User) Validate(inputPassword string) error
- type Users
Constants ¶
const ( Rsync = 1 SSH = 2 Script = 3 )
install trace type
const ( Fail = iota Success )
state type
const ( Disable = iota Enable )
state type
const ( PENDING = iota APPROVE DENY )
review state type
const ( ProjectNotDeploy = 0 ProjectDeploying = 1 ProjectSuccess = 2 ProjectFail = 3 )
Project deploy state
const ( ProjectManualDeploy = 0 ProjectWebhookDeploy = 1 )
Project deploy type
const ( NotifyWeiXin = 1 NotifyDingTalk = 2 NotifyFeiShu = 3 NotifyCustom = 255 )
Project notify type
const ( NotRun = iota Run )
state type
const ( BeforePull = 1 Pull = 2 AfterPull = 3 BeforeDeploy = 4 Deploy = 5 AfterDeploy = 6 )
publish trace state
const GeneralUser = 0
GeneralUser general user
const SuperManager = 1
SuperManager super manager
Variables ¶
var DB *sql.DB
DB init when the program start
Functions ¶
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 Crontab ¶
type Crontab struct { ID int64 `json:"id"` NamespaceID int64 `json:"namespace_id"` Command string `json:"command"` CommandMD5 string `json:"commandMD5"` Creator string `json:"creator"` CreatorID int64 `json:"creatorId"` Editor string `json:"editor"` EditorID int64 `json:"editorId"` InsertTime string `json:"insertTime"` UpdateTime string `json:"updateTime"` }
Crontab -
func (Crontab) AddRowsInCommand ¶
AddRowsInCommand add many rows in command
func (Crontab) GetAllInCommandMD5 ¶
GetAllInCommandMD5 return all row in command md5
type CrontabServer ¶
type CrontabServer struct { ID int64 `json:"id"` CrontabID int64 `json:"crontabId"` ServerID int64 `json:"serverId"` ServerName string `json:"serverName"` ServerIP string `json:"serverIP"` ServerPort int64 `json:"serverPort"` ServerOwner string `json:"serverOwner"` ServerDescription string `json:"serverDescription"` InsertTime string `json:"insertTime"` UpdateTime string `json:"updateTime"` }
CrontabServer -
func (CrontabServer) DeleteByCrontabID ¶ added in v1.0.2
func (cs CrontabServer) DeleteByCrontabID() error
DeleteByCrontabID -
func (CrontabServer) GetAllByCrontabID ¶
func (cs CrontabServer) GetAllByCrontabID() (CrontabServers, error)
GetAllByCrontabID return CrontabServers by CrontabID
func (CrontabServer) GetBindServerListByProjectID ¶
func (cs CrontabServer) GetBindServerListByProjectID() (CrontabServers, error)
GetBindServerListByProjectID return bind server list by project id
type InstallTrace ¶
type InstallTrace struct { ID int64 `json:"id"` Token string `json:"token"` ServerID int64 `json:"serverId"` ServerName string `json:"serverName"` Detail string `json:"detail"` State uint8 `json:"state"` OperatorID int64 `json:"operatorId"` OperatorName string `json:"operatorName"` Type int64 `json:"type"` Ext string `json:"ext"` InstallState int64 `json:"installState"` InsertTime string `json:"insertTime"` UpdateTime string `json:"updateTime"` }
InstallTrace -
func (InstallTrace) AddRow ¶
func (it InstallTrace) AddRow() (int64, error)
AddRow return LastInsertId
func (InstallTrace) GetListByToken ¶
func (it InstallTrace) GetListByToken() (InstallTraces, error)
GetListByToken -
func (InstallTrace) GetListGroupByToken ¶
func (it InstallTrace) GetListGroupByToken() (InstallTraces, error)
GetListGroupByToken -
func (InstallTrace) GetPreviewByProjectID ¶
func (it InstallTrace) GetPreviewByProjectID() (InstallTraces, error)
GetPreviewByProjectID -
type Monitor ¶
type Monitor struct { ID int64 `json:"id"` NamespaceID int64 `json:"namespaceId"` Name string `json:"name"` Domain string `json:"domain"` Port int `json:"port"` Second int `json:"second"` Times uint16 `json:"times"` NotifyType uint8 `json:"notifyType"` NotifyTarget string `json:"notifyTarget"` NotifyTimes uint16 `json:"notifyTimes"` Description string `json:"description"` ErrorContent string `json:"errorContent"` State uint8 `json:"state"` InsertTime string `json:"insertTime"` UpdateTime string `json:"updateTime"` }
Monitor -
type Namespace ¶
type Namespace struct { ID int64 `json:"id"` Name string `json:"name"` UserID int64 `json:"-"` Role string `json:"role"` InsertTime string `json:"insertTime,omitempty"` UpdateTime string `json:"updateTime,omitempty"` }
Namespace -
func (Namespace) GetAllByUserID ¶
func (ns Namespace) GetAllByUserID() (Namespaces, error)
GetAllByUserID -
func (Namespace) GetListByUserID ¶
func (ns Namespace) GetListByUserID(pagination Pagination) (Namespaces, error)
GetListByUserID -
func (Namespace) GetTotalByUserID ¶
GetTotalByUserID -
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"` Role string `json:"role,omitempty"` InsertTime string `json:"insertTime,omitempty"` UpdateTime string `json:"updateTime,omitempty"` }
NamespaceUser -
func (NamespaceUser) AddAdminByNamespaceID ¶
func (nu NamespaceUser) AddAdminByNamespaceID() error
AddAdminByNamespaceID -
func (NamespaceUser) AddAdminByUserID ¶
func (nu NamespaceUser) AddAdminByUserID() error
AddAdminByUserID -
func (NamespaceUser) DeleteByUserID ¶
func (nu NamespaceUser) DeleteByUserID() error
DeleteByUserID -
func (NamespaceUser) GetAllGteManagerByNamespaceID ¶
func (nu NamespaceUser) GetAllGteManagerByNamespaceID() (NamespaceUsers, error)
GetAllGteManagerByNamespaceID -
func (NamespaceUser) GetAllUserByNamespaceID ¶
func (nu NamespaceUser) GetAllUserByNamespaceID() (NamespaceUsers, error)
GetAllUserByNamespaceID -
func (NamespaceUser) GetBindUserListByNamespaceID ¶
func (nu NamespaceUser) GetBindUserListByNamespaceID() (NamespaceUsers, error)
GetBindUserListByNamespaceID -
type Package ¶
type Package struct { ID int64 `json:"id"` Name string `json:"name"` Size int64 `json:"size"` InsertTime string `json:"insertTime"` UpdateTime string `json:"updateTime"` }
Package -
func (Package) GetAllInID ¶ added in v1.0.2
GetAllInID -
type Pagination ¶
type Pagination struct { Page uint64 `json:"page"` Rows uint64 `json:"rows"` Total uint64 `json:"total"` }
Pagination struct
func PaginationFrom ¶
func PaginationFrom(param url.Values) (Pagination, error)
PaginationFrom param return pagination struct
type Project ¶
type Project struct { ID int64 `json:"id"` NamespaceID int64 `json:"namespaceId"` UserID int64 `json:"userId,omitempty"` Name string `json:"name"` URL string `json:"url"` Path string `json:"path"` Environment uint8 `json:"environment"` Branch string `json:"branch"` SymlinkPath string `json:"symlinkPath"` Review uint8 `json:"review"` ReviewURL string `json:"reviewURL"` AfterPullScriptMode string `json:"afterPullScriptMode"` AfterPullScript string `json:"afterPullScript"` AfterDeployScriptMode string `json:"afterDeployScriptMode"` AfterDeployScript string `json:"afterDeployScript"` RsyncOption string `json:"rsyncOption"` 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"` }
Project -
func (Project) DeploySuccess ¶
DeploySuccess set deploy_state to success
func (Project) GetList ¶
func (p Project) GetList(pagination Pagination) (Projects, error)
GetList -
func (Project) GetUserProjectData ¶
GetUserProjectData -
func (Project) GetUserProjectList ¶
GetUserProjectList -
func (Project) ResetState ¶ added in v1.0.7
ResetState set deploy_state to NotDeploy
func (Project) SetAutoDeploy ¶ added in v1.0.2
SetAutoDeploy set auto_deploy
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) 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 ProjectServer ¶
type ProjectServer struct { ID int64 `json:"id"` ProjectID int64 `json:"projectId"` ServerID int64 `json:"serverId"` ServerName string `json:"serverName"` ServerIP string `json:"serverIP"` ServerPort int64 `json:"serverPort"` ServerOwner string `json:"serverOwner"` ServerDescription string `json:"serverDescription"` InsertTime string `json:"insertTime"` UpdateTime string `json:"updateTime"` }
ProjectServer -
func (ProjectServer) GetBindServerListByProjectID ¶
func (ps ProjectServer) GetBindServerListByProjectID() (ProjectServers, error)
GetBindServerListByProjectID -
type ProjectTask ¶
type ProjectTask struct { ID int64 `json:"id"` ProjectID int64 `json:"projectId"` Branch string `json:"branch"` CommitID string `json:"commitId"` 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) GetListByProjectID ¶
func (pt ProjectTask) GetListByProjectID(pagination Pagination) (ProjectTasks, Pagination, error)
GetListByProjectID -
func (ProjectTask) GetNotRunListLTDate ¶
func (pt ProjectTask) GetNotRunListLTDate(date string) (ProjectTasks, error)
GetNotRunListLTDate -
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"` Role string `json:"role,omitempty"` InsertTime string `json:"insertTime"` UpdateTime string `json:"updateTime"` }
ProjectUser -
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) GetBindUserListByProjectID ¶
func (pu ProjectUser) GetBindUserListByProjectID() (ProjectUsers, error)
GetBindUserListByProjectID -
type PublishTrace ¶
type PublishTrace struct { ID int64 `json:"id"` Token string `json:"token"` 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"` PublishState int `json:"publishState"` InsertTime string `json:"insertTime"` UpdateTime string `json:"updateTime"` }
PublishTrace -
func (PublishTrace) AddRow ¶
func (pt PublishTrace) AddRow() (int64, error)
AddRow return LastInsertId
func (PublishTrace) GetListByToken ¶
func (pt PublishTrace) GetListByToken() (PublishTraces, error)
GetListByToken -
func (PublishTrace) GetPreview ¶
func (pt PublishTrace) GetPreview(pagination Pagination) (PublishTraces, Pagination, error)
GetPreview -
type Server ¶
type Server struct { ID int64 `json:"id"` LastInstallToken string `json:"lastInstallToken"` Name string `json:"name"` IP string `json:"ip"` Port int `json:"port"` Owner string `json:"owner"` NamespaceID int64 `json:"namespaceId"` Description string `json:"description"` InsertTime string `json:"insertTime"` UpdateTime string `json:"updateTime"` }
Server -
type Template ¶
type Template struct { ID int64 `json:"id"` Name string `json:"name"` Remark string `json:"remark"` PackageIDStr string `json:"packageIdStr"` Script string `json:"script"` InsertTime string `json:"insertTime"` UpdateTime string `json:"updateTime"` }
Template -
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 -
Source Files
¶
- ChartModel.go
- CrontabModel.go
- CrontabServerModel.go
- InstallTraceModel.go
- Model.go
- MonitorModel.go
- NamespaceModel.go
- NamespaceUserModel.go
- PackageModel.go
- ProjectModel.go
- ProjectReviewModel.go
- ProjectServerModel.go
- ProjectTaskModel.go
- ProjectUserModel.go
- PublishTraceModel.go
- ServerModel.go
- TemplateModel.go
- UserModel.go