예제 #1
0
func (r *AccountRepository) All(offset, limit int) (core.Accounts, error) {
	rows, err := dat.All(r, offset, limit)
	if err != nil {
		log.Printf("Error retrieving Accounts %d to %d: %s", offset, limit, err)
	}

	accountsCol := core.Accounts{}
	if err = rows.All(&accountsCol); err != nil {
		log.Printf("Error decoding rows into slice of accounts: %s", err)
	}
	rows.Close()

	return accountsCol, err
}
예제 #2
0
func (r *PostRepository) All(offset, limit int) (core.Posts, error) {
	rows, err := dat.All(r, offset, limit)
	if err != nil {
		log.Printf("Error retrieving posts %d to %d: %s", offset, limit, err)
		return core.Posts{}, err
	}
	defer rows.Close()

	postsCol := core.Posts{}
	if err = rows.All(&postsCol); err != nil {
		log.Printf("Error decoding rows into slice of posts: %s", err)
		return core.Posts{}, err
	}

	return postsCol, err
}
예제 #3
0
func (r *TopicRepository) All(offset, limit int) (core.Topics, error) {
	rows, err := dat.All(r, offset, limit)
	if err != nil {
		log.Printf("Error retrieving topics %d to %d: %s", offset, limit, err)
		return core.Topics{}, err
	}
	defer rows.Close()

	topicsCol := core.Topics{}
	if err = rows.All(&topicsCol); err != nil {
		log.Printf("Error decoding rows into slice of topics: %s", err)
		return core.Topics{}, err
	}

	return topicsCol, err
}