本文整理汇总了Golang中github.com/dancannon/gorethink.Term.Run方法的典型用法代码示例。如果您正苦于以下问题:Golang Term.Run方法的具体用法?Golang Term.Run怎么用?Golang Term.Run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/dancannon/gorethink.Term
的用法示例。
在下文中一共展示了Term.Run方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: All
func (this *Instance) All(term r.Term, result interface{}) error {
cursor, err := term.Run(this.session)
if err != nil {
return err
}
return cursor.All(result)
}
示例2: Run
func (this *Instance) Run(term r.Term) (*r.Cursor, error) {
session, err := this.connect()
if err != nil {
return nil, err
}
return term.Run(session)
}
示例3: Run
func (d *dbService) Run(t r.Term) (*r.Cursor, error) {
s, err := d.GetSession()
if err != nil {
return nil, err
}
defer s.Close()
return t.Run(s)
}
示例4: getMultiHook
func (s *HookStore) getMultiHook(term r.Term) ([]*download.Hook, error) {
var results []*download.Hook
rows, err := term.Run(s.Session)
if err != nil {
return results, err
}
err = rows.All(&results)
if err != nil {
return nil, err
}
return results, nil
}
示例5: getMultiple
func (a *rethinkAPIServer) getMultiple(
term gorethink.Term,
messageConstructor func() proto.Message,
modifiers ...func(gorethink.Term) gorethink.Term,
) ([]interface{}, error) {
for _, modifier := range modifiers {
term = modifier(term)
}
term = term.Map(func(row gorethink.Term) interface{} {
return row.ToJSON()
})
cursor, err := term.Run(a.session)
if err != nil {
return nil, err
}
return processMultipleCursor(cursor, messageConstructor)
}
示例6: getSingleRequest
func (s *RequestStore) getSingleRequest(term r.Term) (*download.Request, error) {
row, err := term.Run(s.Session)
if err != nil {
return nil, err
}
if row.IsNil() {
return nil, nil
}
var request download.Request
err = row.One(&request)
if err != nil {
return nil, err
}
return &request, nil
}
示例7: getSingleDownload
func (s *DownloadStore) getSingleDownload(term r.Term) (*download.Download, error) {
row, err := term.Run(s.Session)
if err != nil {
return nil, err
}
if row.IsNil() {
return nil, nil
}
var download download.Download
err = row.One(&download)
if err != nil {
return nil, err
}
return &download, nil
}