Beispiel #1
0
func (r *AccountRepository) One(id string) (*core.Account, error) {
	cursor, err := dat.One(r, id)
	if err != nil {
		log.Printf("Error retrieving account %s: %s", id, err)
	}
	defer cursor.Close()

	account := &core.Account{}
	cursor.One(account)

	return account, err
}
Beispiel #2
0
func (r *PostRepository) One(id string) (*core.Post, error) {
	cursor, err := dat.One(r, id)
	if err != nil {
		log.Printf("Error retrieving post %s: %s", id, err)
		return &core.Post{}, err
	}
	defer cursor.Close()

	post := &core.Post{}
	if err = cursor.One(post); err != nil {
		log.Printf("Error decoding post %s: %s", id, err)
		return &core.Post{}, err
	}

	return post, err
}
Beispiel #3
0
func (r *TopicRepository) One(id string) (*core.Topic, error) {
	cursor, err := dat.One(r, id)
	if err != nil {
		log.Printf("Error retrieving topic %s: %s", id, err)
		return &core.Topic{}, err
	}
	defer cursor.Close()

	topic := &core.Topic{}
	if err = cursor.One(topic); err != nil {
		log.Printf("Error decoding row into topic")
		return &core.Topic{}, err
	}

	return topic, err
}