本文整理汇总了Golang中github.com/applikatoni/applikatoni/models.Deployment.State方法的典型用法代码示例。如果您正苦于以下问题:Golang Deployment.State方法的具体用法?Golang Deployment.State怎么用?Golang Deployment.State使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/applikatoni/applikatoni/models.Deployment
的用法示例。
在下文中一共展示了Deployment.State方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: updateDeploymentState
func updateDeploymentState(db *sql.DB, d *models.Deployment, state models.DeploymentState) error {
_, err := db.Exec(deploymentUpdateStateStmt, string(state), d.Id)
if err != nil {
return err
}
d.State = state
return nil
}
示例2: createDeployment
func createDeployment(db *sql.DB, d *models.Deployment) error {
var id int64
var state models.DeploymentState = models.DEPLOYMENT_NEW
var createdAt time.Time = time.Now()
tx, err := db.Begin()
if err != nil {
return err
}
exists, err := activeDeploymentExists(tx, d.TargetName)
if err != nil {
tx.Rollback()
return err
}
if exists {
tx.Rollback()
return ErrDeployInProgress
}
result, err := tx.Exec(deploymentInsertStmt, d.UserId, d.ApplicationName,
d.TargetName, d.CommitSha, d.Branch, d.Comment, string(state), createdAt)
if err != nil {
tx.Rollback()
return err
}
id, err = result.LastInsertId()
if err != nil {
tx.Rollback()
return err
}
d.Id = int(id)
d.State = state
d.CreatedAt = createdAt
tx.Commit()
return nil
}