Beispiel #1
0
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)
}
Beispiel #2
0
func (this *Instance) Run(term r.Term) (*r.Cursor, error) {
	session, err := this.connect()
	if err != nil {
		return nil, err
	}

	return term.Run(session)
}
Beispiel #3
0
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)
}
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
}
Beispiel #5
0
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)
}
Beispiel #6
0
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
}
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
}