本文整理匯總了Golang中github.com/eaigner/hood.Hood.Where方法的典型用法代碼示例。如果您正苦於以下問題:Golang Hood.Where方法的具體用法?Golang Hood.Where怎麽用?Golang Hood.Where使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/eaigner/hood.Hood
的用法示例。
在下文中一共展示了Hood.Where方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: GetWorkflow
func GetWorkflow(tx *hood.Hood, workflowId int64) *Workflow {
var results []Workflow
err := tx.Where("id", "=", workflowId).Find(&results)
if err != nil {
panic(err)
}
if len(results) == 0 {
panic("could not find workflow with given id")
} else {
return &results[0]
}
}
示例2: GetWorkflowBatch
func (rdd *Rdd) GetWorkflowBatch(tx *hood.Hood) *WorkflowBatch {
var results []WorkflowBatch
err := tx.Where("id", "=", rdd.WorkflowBatchId).Find(&results)
if err != nil {
panic(err)
}
if len(results) == 0 {
panic("workflow batch for rdd not found")
} else {
return &results[0]
}
}
示例3: GetSegmentCopy
func GetSegmentCopy(tx *hood.Hood, segmentCopyId int64) *SegmentCopy {
var results []SegmentCopy
err := tx.Where("id", "=", segmentCopyId).Find(&results)
if err != nil {
panic(err)
}
if len(results) == 0 {
panic("could not find segment copy with given id")
} else {
return &results[0]
}
}
示例4: GetWorker
func (segment *Segment) GetWorker(tx *hood.Hood) *Worker {
var results []Worker
err := tx.Where("id", "=", segment.WorkerId).Find(&results)
if err != nil {
panic(err)
}
if len(results) == 0 {
panic("could not find worker for segment")
} else {
return &results[0]
}
}
示例5: GetSegment
func (segmentCopy *SegmentCopy) GetSegment(tx *hood.Hood) *Segment {
var results []Segment
err := tx.Where("id", "=", segmentCopy.SegmentId).Find(&results)
if err != nil {
panic(err)
}
if len(results) == 0 {
panic("could not find rdd with given id")
} else {
return &results[0]
}
}
示例6: GetRdd
func (segment *Segment) GetRdd(tx *hood.Hood) *Rdd {
var results []Rdd
err := tx.Where("id", "=", segment.RddId).Find(&results)
if err != nil {
panic(err)
}
if len(results) == 0 {
panic("could not find rdd with given id")
} else {
return &results[0]
}
}
示例7: loadMoves
func (p *PlayerPokemon) loadMoves(_hood *hood.Hood) {
var pokemonMoves []entities.PlayerPokemonMove
if err := _hood.Where("pokemon_id", "=", p.GetPlayerPokemonId()).Find(&pokemonMoves); err != nil {
log.Error("PlayerPokemon", "loadMoves", "Failed to load PlayerPokemonMoves for PlayerPokemon: %d. Error: %s", p.GetPlayerPokemonId(), err.Error())
} else {
for _, move := range pokemonMoves {
if playerPokemonMove := NewPlayerPokemonMove(&move); playerPokemonMove != nil {
p.moves[playerPokemonMove.GetPlayerPokemonMoveId()] = playerPokemonMove
}
}
}
}
示例8: GetProtojob
func (rdd *Rdd) GetProtojob(tx *hood.Hood) *Protojob {
var results []Protojob
err := tx.Where("id", "=", rdd.ProtojobId).Find(&results)
if err != nil {
panic(err)
}
if len(results) == 0 {
panic("Rdd is missing protojob")
} else {
return &results[0]
}
}
示例9: GetLastWorkflowBatch
func (workflow *Workflow) GetLastWorkflowBatch(tx *hood.Hood) *WorkflowBatch {
var results []WorkflowBatch
err := tx.Where("workflow_id", "=", workflow.Id).OrderBy("start_time").Desc().Limit(1).Find(&results)
if err != nil {
panic(err)
}
if len(results) == 0 {
return nil
} else {
return &results[0]
}
}
示例10: GetInputEdges
func (rdd *Rdd) GetInputEdges(tx *hood.Hood) []*RddEdge {
var results []RddEdge
err := tx.Where("dest_rdd_id", "=", rdd.Id).Find(&results)
if err != nil {
panic(err)
}
// Should return pointers to the result objects so that
// they can be mutated
pointerResults := make([]*RddEdge, len(results))
for i := range results {
pointerResults[i] = &results[i]
}
return pointerResults
}
示例11: GetSegmentCopies
func (segment *Segment) GetSegmentCopies(tx *hood.Hood) []*SegmentCopy {
var results []SegmentCopy
err := tx.Where("segment_id", "=", segment.Id).Find(&results)
if err != nil {
panic(err)
}
// Should return pointers to the result objects so that
// they can be mutated
pointerResults := make([]*SegmentCopy, len(results))
for i := range results {
pointerResults[i] = &results[i]
}
return pointerResults
}
示例12: GetProtojobs
func (workflow *Workflow) GetProtojobs(tx *hood.Hood) []*Protojob {
var results []Protojob
err := tx.Where("workflow_id", "=", workflow.Id).Find(&results)
if err != nil {
panic(err)
}
// Should return pointers to the result objects so that
// they can be mutated
pointerResults := make([]*Protojob, len(results))
for i := range results {
pointerResults[i] = &results[i]
}
return pointerResults
}
示例13: GetWorkersAtAddress
func GetWorkersAtAddress(tx *hood.Hood, address string) []*Worker {
var results []Worker
err := tx.Where("url", "=", address).Find(&results)
if err != nil {
panic(err)
}
// Should return pointers to the result objects so that
// they can be mutated
pointerResults := make([]*Worker, len(results))
for i := range results {
pointerResults[i] = &results[i]
}
return pointerResults
}
示例14: GetAliveWorkers
func GetAliveWorkers(tx *hood.Hood) []*Worker {
var results []Worker
err := tx.Where("status", "=", WORKER_ALIVE).Find(&results)
if err != nil {
panic(err)
}
// Should return pointers to the result objects so that
// they can be mutated
pointerResults := make([]*Worker, len(results))
for i := range results {
pointerResults[i] = &results[i]
}
return pointerResults
}
示例15: GetRdds
func (workflowBatch *WorkflowBatch) GetRdds(tx *hood.Hood) []*Rdd {
var results []Rdd
err := tx.Where("workflow_batch_id", "=", workflowBatch.Id).Find(&results)
if err != nil {
panic(err)
}
// Should return pointers to the result objects so that
// they can be mutated
pointerResults := make([]*Rdd, len(results))
for i := range results {
pointerResults[i] = &results[i]
}
return pointerResults
}