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

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

	return account, err
}
Example #2
0
func (r *ClientRepository) Find(key string) (*Client, error) {
	cursor, err := dat.Match(r, "key", key)
	if err != nil {
		log.Printf("Error retrieving client %s: %s", key, err)
	}
	defer cursor.Close()

	client := &Client{}
	cursor.One(client)

	return client, err
}