本文整理匯總了Golang中github.com/concourse/atc.PlanConfig.Location方法的典型用法代碼示例。如果您正苦於以下問題:Golang PlanConfig.Location方法的具體用法?Golang PlanConfig.Location怎麽用?Golang PlanConfig.Location使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/concourse/atc.PlanConfig
的用法示例。
在下文中一共展示了PlanConfig.Location方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: populatePlanLocations
func populatePlanLocations(planConfig *atc.PlanConfig, location *atc.Location) uint {
var stepCount uint
var parentID uint
parentID = location.ID
switch {
case planConfig.Put != "":
planConfig.Location = location
// offset by one for the dependent get that will be added
stepCount = stepCount + 1
case planConfig.Do != nil:
children := *planConfig.Do
parentID = location.ID + 1
for i := 0; i < len(children); i++ {
child := children[i]
childLocation := &atc.Location{
ID: location.ID + stepCount + 1,
ParentID: location.ParentID,
ParallelGroup: 0,
Hook: location.Hook,
}
stepCount = stepCount + populatePlanLocations(&child, childLocation)
children[i] = child
}
case planConfig.Try != nil:
childLocation := &atc.Location{
ID: location.ID + stepCount + 1,
ParentID: location.ParentID,
ParallelGroup: 0,
Hook: location.Hook,
}
stepCount = stepCount + populatePlanLocations(planConfig.Try, childLocation)
case planConfig.Aggregate != nil:
parallelGroup := location.ID + 1
stepCount += 1
if location.ParallelGroup != 0 {
location.ParentID = location.ParallelGroup
}
children := *planConfig.Aggregate
for i := 0; i < len(children); i++ {
child := children[i]
childLocation := &atc.Location{
ID: location.ID + stepCount + 1,
ParentID: location.ParentID,
ParallelGroup: parallelGroup,
}
if child.Aggregate == nil {
childLocation.Hook = location.Hook
}
stepCount = stepCount + populatePlanLocations(&child, childLocation)
children[i] = child
}
parentID = parallelGroup
default:
planConfig.Location = location
}
if planConfig.Failure != nil {
child := planConfig.Failure
childLocation := &atc.Location{
ID: location.ID + stepCount + 1,
ParentID: parentID,
ParallelGroup: 0,
Hook: "failure",
}
stepCount = stepCount + populatePlanLocations(child, childLocation)
}
if planConfig.Success != nil {
child := planConfig.Success
childLocation := &atc.Location{
ID: location.ID + stepCount + 1,
ParentID: parentID,
ParallelGroup: 0,
Hook: "success",
}
stepCount = stepCount + populatePlanLocations(child, childLocation)
}
if planConfig.Ensure != nil {
child := planConfig.Ensure
childLocation := &atc.Location{
ID: location.ID + stepCount + 1,
ParentID: parentID,
ParallelGroup: 0,
Hook: "ensure",
}
stepCount = stepCount + populatePlanLocations(child, childLocation)
}
return stepCount + 1
}
示例2: populateLocations
func (l locationPopulator) populateLocations(planConfig *atc.PlanConfig, location *atc.Location) uint {
var stepCount uint
var parentID uint
parentID = location.ID
switch {
case planConfig.Put != "":
planConfig.Location = location
// offset by one for the dependent get that will be added
stepCount = stepCount + 1
case planConfig.Do != nil:
// TODO: Do we actually need to increment these two here? See aggregate location.
serialGroup := location.ID + 1
stepCount += 1
if location.SerialGroup != 0 {
location.ParentID = location.SerialGroup
}
children := *planConfig.Do
for i := 0; i < len(children); i++ {
child := children[i]
childLocation := &atc.Location{
ID: location.ID + stepCount + 1,
ParentID: location.ParentID,
ParallelGroup: location.ParallelGroup,
SerialGroup: serialGroup,
}
if child.Do == nil {
childLocation.Hook = location.Hook
}
stepCount = stepCount + l.populateLocations(&child, childLocation)
children[i] = child
}
parentID = serialGroup
case planConfig.Try != nil:
childLocation := &atc.Location{
ID: location.ID + stepCount + 1,
ParentID: location.ParentID,
ParallelGroup: 0,
Hook: location.Hook,
}
stepCount = stepCount + l.populateLocations(planConfig.Try, childLocation)
case planConfig.Aggregate != nil:
// TODO: Do we actually need to increment these two here? See do location.
parallelGroup := location.ID + 1
stepCount += 1
if location.ParallelGroup != 0 {
location.ParentID = location.ParallelGroup
}
children := *planConfig.Aggregate
for i := 0; i < len(children); i++ {
child := children[i]
childLocation := &atc.Location{
ID: location.ID + stepCount + 1,
ParentID: location.ParentID,
ParallelGroup: parallelGroup,
SerialGroup: location.SerialGroup,
}
if child.Aggregate == nil && child.Do == nil {
childLocation.Hook = location.Hook
}
stepCount = stepCount + l.populateLocations(&child, childLocation)
children[i] = child
}
parentID = parallelGroup
default:
planConfig.Location = location
}
if planConfig.Failure != nil {
child := planConfig.Failure
childLocation := &atc.Location{
ID: location.ID + stepCount + 1,
ParentID: parentID,
ParallelGroup: 0,
Hook: "failure",
}
stepCount = stepCount + l.populateLocations(child, childLocation)
}
if planConfig.Success != nil {
child := planConfig.Success
childLocation := &atc.Location{
ID: location.ID + stepCount + 1,
ParentID: parentID,
ParallelGroup: 0,
Hook: "success",
}
stepCount = stepCount + l.populateLocations(child, childLocation)
//.........這裏部分代碼省略.........