本文整理匯總了Golang中github.com/dancannon/gorethink.Session.Use方法的典型用法代碼示例。如果您正苦於以下問題:Golang Session.Use方法的具體用法?Golang Session.Use怎麽用?Golang Session.Use使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/dancannon/gorethink.Session
的用法示例。
在下文中一共展示了Session.Use方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: seedRethinkdbChecks
func seedRethinkdbChecks(s *r.Session) error {
r.DB("alerts").TableCreate("checks").RunWrite(s)
data := []*Check{
&Check{
Id: "elasticsearch-es_heap",
Type: "elasticsearch",
Name: "es_heap",
Level: 1,
Title: "Elasticsearch Heap",
Description: "total heap usage by an elasticsearch node",
},
&Check{
Id: "elasticsearch-es_cluster_status",
Type: "elasticsearch",
Name: "es_heap",
Level: 1,
Title: "Elasticsearch Cluster Status",
Description: "cluster status (green/yello/red)",
},
&Check{
Id: "redis-role",
Type: "redis",
Name: "redis_role",
Level: 1,
Title: "Redis Role",
Description: "role of redis server (master/slave)",
},
}
s.Use("alerts")
for _, check := range data {
r.Table("checks").Insert(check).RunWrite(s)
}
r.Table("checks").IndexCreateFunc("type_name", func(row r.Term) interface{} {
return []interface{}{row.Field("type"), row.Field("name")}
}).RunWrite(s)
return nil
}