本文整理汇总了Golang中github.com/applikatoni/applikatoni/models.Deployment类的典型用法代码示例。如果您正苦于以下问题:Golang Deployment类的具体用法?Golang Deployment怎么用?Golang Deployment使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Deployment类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: buildDeploymentEvent
func (hub *DeploymentEventHub) buildDeploymentEvent(s models.DeploymentState, d *models.Deployment) (*DeploymentEvent, error) {
user, err := getUser(hub.db, d.UserId)
if err != nil {
return nil, err
}
d.User = user
application, err := findApplication(d.ApplicationName)
if err != nil {
return nil, err
}
target, err := findTarget(application, d.TargetName)
if err != nil {
return nil, err
}
event := &DeploymentEvent{
State: s,
Deployment: d,
Application: application,
Target: target,
User: user,
}
return event, nil
}
开发者ID:applikatoni,项目名称:applikatoni,代码行数:27,代码来源:deployment_event_hub.go
示例2: 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
}
开发者ID:MahaKoala,项目名称:applikatoni,代码行数:9,代码来源:database.go
示例3: 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
}
开发者ID:MahaKoala,项目名称:applikatoni,代码行数:40,代码来源:database.go
注:本文中的github.com/applikatoni/applikatoni/models.Deployment类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论