2022-04-09 21:53:37 +08:00
|
|
|
// Copyright 2022 The Goploy Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a GPLv3-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
2020-08-04 14:28:25 +08:00
|
|
|
package model
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
sq "github.com/Masterminds/squirrel"
|
|
|
|
)
|
|
|
|
|
|
|
|
const projectTable = "`project`"
|
|
|
|
|
|
|
|
type Project struct {
|
|
|
|
ID int64 `json:"id"`
|
|
|
|
NamespaceID int64 `json:"namespaceId"`
|
|
|
|
UserID int64 `json:"userId,omitempty"`
|
2021-08-19 14:40:42 +08:00
|
|
|
RepoType string `json:"repoType"`
|
2020-08-04 14:28:25 +08:00
|
|
|
Name string `json:"name"`
|
|
|
|
URL string `json:"url"`
|
|
|
|
Path string `json:"path"`
|
2020-09-02 17:08:11 +08:00
|
|
|
Environment uint8 `json:"environment"`
|
2020-08-04 14:28:25 +08:00
|
|
|
Branch string `json:"branch"`
|
2020-09-25 20:05:25 +08:00
|
|
|
SymlinkPath string `json:"symlinkPath"`
|
2021-08-20 10:36:25 +08:00
|
|
|
SymlinkBackupNumber uint8 `json:"symlinkBackupNumber"`
|
2020-09-25 20:05:25 +08:00
|
|
|
Review uint8 `json:"review"`
|
|
|
|
ReviewURL string `json:"reviewURL"`
|
2020-08-04 14:28:25 +08:00
|
|
|
AfterPullScriptMode string `json:"afterPullScriptMode"`
|
|
|
|
AfterPullScript string `json:"afterPullScript"`
|
|
|
|
AfterDeployScriptMode string `json:"afterDeployScriptMode"`
|
|
|
|
AfterDeployScript string `json:"afterDeployScript"`
|
2022-05-12 19:38:53 +08:00
|
|
|
TransferType string `json:"transferType"`
|
|
|
|
TransferOption string `json:"transferOption"`
|
2020-08-04 14:28:25 +08:00
|
|
|
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"`
|
|
|
|
}
|
|
|
|
|
2020-08-15 13:38:06 +08:00
|
|
|
// Project deploy state
|
2020-08-04 14:28:25 +08:00
|
|
|
const (
|
|
|
|
ProjectNotDeploy = 0
|
|
|
|
ProjectDeploying = 1
|
|
|
|
ProjectSuccess = 2
|
|
|
|
ProjectFail = 3
|
|
|
|
)
|
|
|
|
|
2020-08-15 13:38:06 +08:00
|
|
|
// Project deploy type
|
2020-08-04 14:28:25 +08:00
|
|
|
const (
|
|
|
|
ProjectManualDeploy = 0
|
|
|
|
ProjectWebhookDeploy = 1
|
|
|
|
)
|
|
|
|
|
2021-12-03 15:54:01 +08:00
|
|
|
const (
|
2022-03-10 18:25:58 +08:00
|
|
|
RepoGit = "git"
|
|
|
|
RepoSVN = "svn"
|
|
|
|
RepoFTP = "ftp"
|
|
|
|
RepoSFTP = "sftp"
|
2021-12-03 15:54:01 +08:00
|
|
|
)
|
|
|
|
|
2020-08-15 13:38:06 +08:00
|
|
|
// Project notify type
|
2020-08-04 14:28:25 +08:00
|
|
|
const (
|
2020-08-04 20:00:21 +08:00
|
|
|
NotifyWeiXin = 1
|
|
|
|
NotifyDingTalk = 2
|
|
|
|
NotifyFeiShu = 3
|
|
|
|
NotifyCustom = 255
|
2020-08-04 14:28:25 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
type Projects []Project
|
|
|
|
|
|
|
|
func (p Project) AddRow() (int64, error) {
|
|
|
|
result, err := sq.
|
|
|
|
Insert(projectTable).
|
2020-09-25 20:05:25 +08:00
|
|
|
Columns(
|
|
|
|
"namespace_id",
|
|
|
|
"name",
|
2021-08-19 14:40:42 +08:00
|
|
|
"repo_type",
|
2020-09-25 20:05:25 +08:00
|
|
|
"url",
|
|
|
|
"path",
|
|
|
|
"environment",
|
|
|
|
"branch",
|
|
|
|
"symlink_path",
|
2021-08-20 10:36:25 +08:00
|
|
|
"symlink_backup_number",
|
2020-09-25 20:05:25 +08:00
|
|
|
"review",
|
|
|
|
"review_url",
|
|
|
|
"after_pull_script_mode",
|
|
|
|
"after_pull_script",
|
|
|
|
"after_deploy_script_mode",
|
|
|
|
"after_deploy_script",
|
2022-05-12 19:38:53 +08:00
|
|
|
"transfer_type",
|
|
|
|
"transfer_option",
|
2020-09-25 20:05:25 +08:00
|
|
|
"notify_type",
|
|
|
|
"notify_target",
|
|
|
|
).
|
|
|
|
Values(
|
|
|
|
p.NamespaceID,
|
|
|
|
p.Name,
|
2021-08-19 14:40:42 +08:00
|
|
|
p.RepoType,
|
2020-09-25 20:05:25 +08:00
|
|
|
p.URL,
|
|
|
|
p.Path,
|
|
|
|
p.Environment,
|
|
|
|
p.Branch,
|
|
|
|
p.SymlinkPath,
|
2021-08-20 10:36:25 +08:00
|
|
|
p.SymlinkBackupNumber,
|
2020-09-25 20:05:25 +08:00
|
|
|
p.Review,
|
|
|
|
p.ReviewURL,
|
|
|
|
p.AfterPullScriptMode,
|
|
|
|
p.AfterPullScript,
|
|
|
|
p.AfterDeployScriptMode,
|
|
|
|
p.AfterDeployScript,
|
2022-05-12 19:38:53 +08:00
|
|
|
p.TransferType,
|
|
|
|
p.TransferOption,
|
2020-09-25 20:05:25 +08:00
|
|
|
p.NotifyType,
|
|
|
|
p.NotifyTarget,
|
|
|
|
).
|
2020-08-04 14:28:25 +08:00
|
|
|
RunWith(DB).
|
|
|
|
Exec()
|
|
|
|
if err != nil {
|
|
|
|
return 0, err
|
|
|
|
}
|
|
|
|
id, err := result.LastInsertId()
|
|
|
|
return id, err
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p Project) EditRow() error {
|
|
|
|
_, err := sq.
|
|
|
|
Update(projectTable).
|
|
|
|
SetMap(sq.Eq{
|
|
|
|
"name": p.Name,
|
2021-08-19 14:40:42 +08:00
|
|
|
"repo_type": p.RepoType,
|
2020-08-04 14:28:25 +08:00
|
|
|
"url": p.URL,
|
|
|
|
"path": p.Path,
|
|
|
|
"environment": p.Environment,
|
|
|
|
"branch": p.Branch,
|
2020-09-25 20:05:25 +08:00
|
|
|
"symlink_path": p.SymlinkPath,
|
2021-08-20 10:36:25 +08:00
|
|
|
"symlink_backup_number": p.SymlinkBackupNumber,
|
2020-09-25 20:05:25 +08:00
|
|
|
"review": p.Review,
|
|
|
|
"review_url": p.ReviewURL,
|
2020-08-04 14:28:25 +08:00
|
|
|
"after_pull_script_mode": p.AfterPullScriptMode,
|
|
|
|
"after_pull_script": p.AfterPullScript,
|
|
|
|
"after_deploy_script_mode": p.AfterDeployScriptMode,
|
|
|
|
"after_deploy_script": p.AfterDeployScript,
|
2022-05-12 19:38:53 +08:00
|
|
|
"transfer_type": p.TransferType,
|
|
|
|
"transfer_option": p.TransferOption,
|
2020-08-04 14:28:25 +08:00
|
|
|
"notify_type": p.NotifyType,
|
|
|
|
"notify_target": p.NotifyTarget,
|
|
|
|
}).
|
|
|
|
Where(sq.Eq{"id": p.ID}).
|
|
|
|
RunWith(DB).
|
|
|
|
Exec()
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2020-08-20 14:16:37 +08:00
|
|
|
func (p Project) SetAutoDeploy() error {
|
|
|
|
_, err := sq.
|
|
|
|
Update(projectTable).
|
|
|
|
SetMap(sq.Eq{
|
|
|
|
"auto_deploy": p.AutoDeploy,
|
|
|
|
}).
|
|
|
|
Where(sq.Eq{"id": p.ID}).
|
|
|
|
RunWith(DB).
|
|
|
|
Exec()
|
|
|
|
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2020-08-04 14:28:25 +08:00
|
|
|
func (p Project) RemoveRow() error {
|
|
|
|
_, err := sq.
|
|
|
|
Update(projectTable).
|
|
|
|
SetMap(sq.Eq{
|
|
|
|
"state": Disable,
|
|
|
|
}).
|
|
|
|
Where(sq.Eq{"id": p.ID}).
|
|
|
|
RunWith(DB).
|
|
|
|
Exec()
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p Project) Publish() error {
|
|
|
|
_, err := sq.
|
|
|
|
Update(projectTable).
|
|
|
|
SetMap(sq.Eq{
|
|
|
|
"publisher_id": p.PublisherID,
|
|
|
|
"publisher_name": p.PublisherName,
|
|
|
|
"deploy_state": p.DeployState,
|
|
|
|
"last_publish_token": p.LastPublishToken,
|
|
|
|
}).
|
|
|
|
Where(sq.Eq{"id": p.ID}).
|
|
|
|
RunWith(DB).
|
|
|
|
Exec()
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2020-11-23 17:49:38 +08:00
|
|
|
// ResetState set deploy_state to NotDeploy
|
|
|
|
func (p Project) ResetState() error {
|
|
|
|
_, err := sq.
|
|
|
|
Update(projectTable).
|
|
|
|
SetMap(sq.Eq{
|
|
|
|
"deploy_state": ProjectNotDeploy,
|
|
|
|
}).
|
|
|
|
Where(sq.Eq{"id": p.ID}).
|
|
|
|
RunWith(DB).
|
|
|
|
Exec()
|
|
|
|
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2020-08-15 13:38:06 +08:00
|
|
|
// DeploySuccess set deploy_state to success
|
2020-08-04 14:28:25 +08:00
|
|
|
func (p Project) DeploySuccess() error {
|
|
|
|
_, err := sq.
|
|
|
|
Update(projectTable).
|
|
|
|
SetMap(sq.Eq{
|
|
|
|
"deploy_state": ProjectSuccess,
|
|
|
|
}).
|
|
|
|
Where(sq.Eq{"id": p.ID}).
|
|
|
|
RunWith(DB).
|
|
|
|
Exec()
|
|
|
|
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2020-08-15 13:38:06 +08:00
|
|
|
// DeployFail set deploy_state to fail
|
2020-08-04 14:28:25 +08:00
|
|
|
func (p Project) DeployFail() error {
|
|
|
|
_, err := sq.
|
|
|
|
Update(projectTable).
|
|
|
|
SetMap(sq.Eq{
|
|
|
|
"deploy_state": ProjectFail,
|
|
|
|
}).
|
|
|
|
Where(sq.Eq{"id": p.ID}).
|
|
|
|
RunWith(DB).
|
|
|
|
Exec()
|
|
|
|
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2022-04-09 11:06:15 +08:00
|
|
|
func (p Project) GetList() (Projects, error) {
|
2020-08-04 14:28:25 +08:00
|
|
|
builder := sq.
|
2020-09-25 20:05:25 +08:00
|
|
|
Select(`
|
|
|
|
project.id,
|
|
|
|
name,
|
2021-08-19 14:40:42 +08:00
|
|
|
repo_type,
|
2020-09-25 20:05:25 +08:00
|
|
|
url,
|
|
|
|
path,
|
|
|
|
environment,
|
|
|
|
branch,
|
|
|
|
symlink_path,
|
2021-08-20 10:36:25 +08:00
|
|
|
symlink_backup_number,
|
2020-09-25 20:05:25 +08:00
|
|
|
review,
|
|
|
|
review_url,
|
|
|
|
after_pull_script_mode,
|
|
|
|
after_pull_script,
|
|
|
|
after_deploy_script_mode,
|
|
|
|
after_deploy_script,
|
2022-05-12 19:38:53 +08:00
|
|
|
transfer_type,
|
|
|
|
transfer_option,
|
2020-09-25 20:05:25 +08:00
|
|
|
auto_deploy,
|
|
|
|
notify_type,
|
|
|
|
notify_target,
|
|
|
|
project.insert_time,
|
|
|
|
project.update_time
|
|
|
|
`).
|
2020-08-04 14:28:25 +08:00
|
|
|
From(projectTable).
|
|
|
|
Where(sq.Eq{
|
|
|
|
"namespace_id": p.NamespaceID,
|
|
|
|
"state": Enable,
|
|
|
|
})
|
|
|
|
|
2022-04-09 11:06:15 +08:00
|
|
|
if p.UserID > 0 {
|
|
|
|
builder = builder.
|
|
|
|
Join(projectUserTable + " ON project_user.project_id = project.id").
|
|
|
|
Where(sq.Eq{"user_id": p.UserID})
|
2020-08-04 14:28:25 +08:00
|
|
|
}
|
|
|
|
|
2022-04-09 11:06:15 +08:00
|
|
|
rows, err := builder.
|
2020-08-04 14:28:25 +08:00
|
|
|
OrderBy("id DESC").
|
|
|
|
RunWith(DB).
|
|
|
|
Query()
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
projects := Projects{}
|
|
|
|
for rows.Next() {
|
|
|
|
var project Project
|
|
|
|
|
|
|
|
if err := rows.Scan(
|
|
|
|
&project.ID,
|
|
|
|
&project.Name,
|
2021-08-19 14:40:42 +08:00
|
|
|
&project.RepoType,
|
2020-08-04 14:28:25 +08:00
|
|
|
&project.URL,
|
|
|
|
&project.Path,
|
|
|
|
&project.Environment,
|
|
|
|
&project.Branch,
|
2020-09-25 20:05:25 +08:00
|
|
|
&project.SymlinkPath,
|
2021-08-20 10:36:25 +08:00
|
|
|
&project.SymlinkBackupNumber,
|
2020-09-25 20:05:25 +08:00
|
|
|
&project.Review,
|
|
|
|
&project.ReviewURL,
|
2020-08-04 14:28:25 +08:00
|
|
|
&project.AfterPullScriptMode,
|
|
|
|
&project.AfterPullScript,
|
|
|
|
&project.AfterDeployScriptMode,
|
|
|
|
&project.AfterDeployScript,
|
2022-05-12 19:38:53 +08:00
|
|
|
&project.TransferType,
|
|
|
|
&project.TransferOption,
|
2020-08-04 14:28:25 +08:00
|
|
|
&project.AutoDeploy,
|
|
|
|
&project.NotifyType,
|
|
|
|
&project.NotifyTarget,
|
|
|
|
&project.InsertTime,
|
|
|
|
&project.UpdateTime,
|
|
|
|
); err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
projects = append(projects, project)
|
|
|
|
}
|
|
|
|
|
|
|
|
return projects, nil
|
|
|
|
}
|
|
|
|
|
2022-04-09 21:45:53 +08:00
|
|
|
func (p Project) GetDeployList() (Projects, error) {
|
|
|
|
builder := sq.
|
2020-08-04 14:28:25 +08:00
|
|
|
Select(`
|
|
|
|
project.id,
|
|
|
|
project.name,
|
2021-08-19 14:40:42 +08:00
|
|
|
project.repo_type,
|
2022-05-12 19:38:53 +08:00
|
|
|
project.transfer_type,
|
2020-08-14 20:03:35 +08:00
|
|
|
project.url,
|
2020-08-04 14:28:25 +08:00
|
|
|
project.publisher_id,
|
|
|
|
project.publisher_name,
|
|
|
|
IFNULL(publish_trace.ext, '{}'),
|
|
|
|
project.environment,
|
|
|
|
project.branch,
|
2022-05-15 13:49:25 +08:00
|
|
|
project.symlink_path,
|
2020-09-25 20:05:25 +08:00
|
|
|
project.review,
|
2020-08-04 14:28:25 +08:00
|
|
|
project.last_publish_token,
|
2021-12-23 14:54:00 +08:00
|
|
|
project.auto_deploy,
|
2020-08-04 14:28:25 +08:00
|
|
|
project.deploy_state,
|
|
|
|
project.update_time`).
|
2022-04-09 21:45:53 +08:00
|
|
|
From(projectTable).
|
2020-08-04 14:28:25 +08:00
|
|
|
LeftJoin(fmt.Sprintf("%[1]s ON %[1]s.token = %s.last_publish_token and type = %d", publishTraceTable, projectTable, Pull)).
|
|
|
|
Where(sq.Eq{
|
|
|
|
"project.namespace_id": p.NamespaceID,
|
|
|
|
"project.state": Enable,
|
2022-04-09 21:45:53 +08:00
|
|
|
})
|
|
|
|
|
|
|
|
if p.UserID > 0 {
|
|
|
|
builder = builder.
|
|
|
|
LeftJoin(projectUserTable + " ON project_user.project_id = project.id").
|
|
|
|
Where(sq.Eq{"project_user.user_id": p.UserID})
|
|
|
|
}
|
|
|
|
|
|
|
|
rows, err := builder.
|
2021-02-14 14:22:22 +08:00
|
|
|
OrderBy("project.id DESC").
|
|
|
|
RunWith(DB).
|
|
|
|
Query()
|
2022-04-09 21:45:53 +08:00
|
|
|
|
2020-08-04 14:28:25 +08:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
projects := Projects{}
|
|
|
|
for rows.Next() {
|
|
|
|
var project Project
|
|
|
|
|
|
|
|
if err := rows.Scan(
|
|
|
|
&project.ID,
|
|
|
|
&project.Name,
|
2021-08-19 14:40:42 +08:00
|
|
|
&project.RepoType,
|
2022-05-12 19:38:53 +08:00
|
|
|
&project.TransferType,
|
2020-08-14 20:03:35 +08:00
|
|
|
&project.URL,
|
2020-08-04 14:28:25 +08:00
|
|
|
&project.PublisherID,
|
|
|
|
&project.PublisherName,
|
|
|
|
&project.PublishExt,
|
|
|
|
&project.Environment,
|
|
|
|
&project.Branch,
|
2022-05-15 13:49:25 +08:00
|
|
|
&project.SymlinkPath,
|
2020-09-25 20:05:25 +08:00
|
|
|
&project.Review,
|
2020-08-04 14:28:25 +08:00
|
|
|
&project.LastPublishToken,
|
2021-12-23 14:54:00 +08:00
|
|
|
&project.AutoDeploy,
|
2020-08-04 14:28:25 +08:00
|
|
|
&project.DeployState,
|
|
|
|
&project.UpdateTime); err != nil {
|
|
|
|
return projects, err
|
|
|
|
}
|
|
|
|
projects = append(projects, project)
|
|
|
|
}
|
|
|
|
|
|
|
|
return projects, nil
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p Project) GetData() (Project, error) {
|
|
|
|
var project Project
|
|
|
|
err := sq.
|
2021-08-20 10:36:25 +08:00
|
|
|
Select(`
|
|
|
|
id,
|
|
|
|
namespace_id,
|
|
|
|
name,
|
|
|
|
repo_type,
|
|
|
|
url,
|
|
|
|
path,
|
|
|
|
environment,
|
|
|
|
branch,
|
|
|
|
symlink_path,
|
|
|
|
symlink_backup_number,
|
|
|
|
review,
|
|
|
|
review_url,
|
|
|
|
after_pull_script_mode,
|
|
|
|
after_pull_script,
|
|
|
|
after_deploy_script_mode,
|
|
|
|
after_deploy_script,
|
2022-05-12 19:38:53 +08:00
|
|
|
transfer_type,
|
|
|
|
transfer_option,
|
2021-08-20 10:36:25 +08:00
|
|
|
auto_deploy,
|
|
|
|
deploy_state,
|
|
|
|
notify_type,
|
|
|
|
notify_target,
|
|
|
|
project.
|
|
|
|
last_publish_token,
|
|
|
|
insert_time,
|
|
|
|
update_time`).
|
2020-08-04 14:28:25 +08:00
|
|
|
From(projectTable).
|
|
|
|
Where(sq.Eq{"id": p.ID}).
|
|
|
|
RunWith(DB).
|
|
|
|
QueryRow().
|
|
|
|
Scan(
|
|
|
|
&project.ID,
|
|
|
|
&project.NamespaceID,
|
|
|
|
&project.Name,
|
2021-08-19 14:40:42 +08:00
|
|
|
&project.RepoType,
|
2020-08-04 14:28:25 +08:00
|
|
|
&project.URL,
|
|
|
|
&project.Path,
|
|
|
|
&project.Environment,
|
|
|
|
&project.Branch,
|
2020-09-25 20:05:25 +08:00
|
|
|
&project.SymlinkPath,
|
2021-08-20 10:36:25 +08:00
|
|
|
&project.SymlinkBackupNumber,
|
2020-09-25 20:05:25 +08:00
|
|
|
&project.Review,
|
|
|
|
&project.ReviewURL,
|
2020-08-04 14:28:25 +08:00
|
|
|
&project.AfterPullScriptMode,
|
|
|
|
&project.AfterPullScript,
|
|
|
|
&project.AfterDeployScriptMode,
|
|
|
|
&project.AfterDeployScript,
|
2022-05-12 19:38:53 +08:00
|
|
|
&project.TransferType,
|
|
|
|
&project.TransferOption,
|
2020-08-04 14:28:25 +08:00
|
|
|
&project.AutoDeploy,
|
|
|
|
&project.DeployState,
|
|
|
|
&project.NotifyType,
|
|
|
|
&project.NotifyTarget,
|
2021-02-12 23:05:06 +08:00
|
|
|
&project.LastPublishToken,
|
2020-08-04 14:28:25 +08:00
|
|
|
&project.InsertTime,
|
|
|
|
&project.UpdateTime)
|
|
|
|
if err != nil {
|
|
|
|
return project, err
|
|
|
|
}
|
|
|
|
return project, nil
|
|
|
|
}
|
|
|
|
|
2020-08-19 10:22:43 +08:00
|
|
|
func (p Project) GetUserProjectData() (Project, error) {
|
2020-08-04 14:28:25 +08:00
|
|
|
var project Project
|
|
|
|
err := sq.
|
|
|
|
Select("project_id, project.name, publisher_id, publisher_name, project.environment, project.branch, project.last_publish_token, project.deploy_state").
|
|
|
|
From(projectUserTable).
|
|
|
|
LeftJoin(projectTable+" ON project_user.project_id = project.id").
|
|
|
|
Where(sq.Eq{
|
|
|
|
"project_user.project_id": p.ID,
|
2020-08-19 10:22:43 +08:00
|
|
|
"project_user.user_id": p.UserID,
|
2020-08-04 14:28:25 +08:00
|
|
|
"project.state": Enable,
|
|
|
|
}).
|
|
|
|
RunWith(DB).
|
|
|
|
QueryRow().
|
|
|
|
Scan(&project.ID,
|
|
|
|
&project.Name,
|
|
|
|
&project.PublisherID,
|
|
|
|
&project.PublisherName,
|
|
|
|
&project.Environment,
|
|
|
|
&project.Branch,
|
|
|
|
&project.LastPublishToken,
|
|
|
|
&project.DeployState)
|
|
|
|
if err != nil {
|
|
|
|
return project, err
|
|
|
|
}
|
|
|
|
return project, nil
|
|
|
|
}
|