本文整理匯總了Golang中github.com/NetSys/quilt/db.Database.SelectFromConnection方法的典型用法代碼示例。如果您正苦於以下問題:Golang Database.SelectFromConnection方法的具體用法?Golang Database.SelectFromConnection怎麽用?Golang Database.SelectFromConnection使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/NetSys/quilt/db.Database
的用法示例。
在下文中一共展示了Database.SelectFromConnection方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: updateConnections
func updateConnections(view db.Database, spec stitch.Stitch) {
scs, vcs := stitch.ConnectionSlice(spec.Connections),
view.SelectFromConnection(nil)
dbcKey := func(val interface{}) interface{} {
c := val.(db.Connection)
return stitch.Connection{
From: c.From,
To: c.To,
MinPort: c.MinPort,
MaxPort: c.MaxPort,
}
}
pairs, stitches, dbcs := join.HashJoin(scs, db.ConnectionSlice(vcs), nil, dbcKey)
for _, dbc := range dbcs {
view.Remove(dbc.(db.Connection))
}
for _, stitchc := range stitches {
pairs = append(pairs, join.Pair{L: stitchc, R: view.InsertConnection()})
}
for _, pair := range pairs {
stitchc := pair.L.(stitch.Connection)
dbc := pair.R.(db.Connection)
dbc.From = stitchc.From
dbc.To = stitchc.To
dbc.MinPort = stitchc.MinPort
dbc.MaxPort = stitchc.MaxPort
view.Commit(dbc)
}
}