// Get and serialize all members of a set func GetAreasMembers(areas []string) []Entity { conn := db.Pool.Get() defer conn.Close() keys := []string{} entityList := []Entity{} for _, area := range areas { result, err := db.Smembers(conn, area) if err != nil { continue } keys = append(keys, result...) } for _, key := range keys { record, err := db.Get(conn, key) if err != nil { continue } entityList = append(entityList, Load(key, record)) } return entityList }
// Fetches a single record in the database, by given concrete key. // If there is no entity with such key, returns error. func Get(key string) (Entity, error) { conn := db.Pool.Get() defer conn.Close() record, err := db.Get(conn, key) if err != nil { return nil, err } return Load(key, record), nil }