示例#1
0
func getContact(c redis.Client, name string) Contact {
	contact := Contact{}
	items, err := c.Hgetall(CONTACT_PREFIX + ":" + name)
	if err == nil {
		for j := 0; j < len(items)/2; j += 2 {
			k := string(items[j])
			v := string(items[j+1])
			switch k {
			case "name":
				{
					contact.Name = v
				}
			case "email":
				{
					contact.EmailAddress = v
				}
			}
		}
	}
	return contact
}