code: func addReading(conn redis.Conn, tx bool, r contract.Reading) (id string, err error) {
  	if r.Created == 0 {
  		r.Created = db.MakeTimestamp()
  	}
  
  	if r.Id == "" {
  		r.Id = uuid.New().String()
  	}
  
  	m, err := marshalObject(r)
  	if err != nil {
  		return r.Id, err
  	}
  
  	if tx {
  		_ = conn.Send("MULTI")
  	}
  	_ = conn.Send("SET", r.Id, m)
  	_ = conn.Send("ZADD", db.ReadingsCollection, 0, r.Id)
  	_ = conn.Send("ZADD", db.ReadingsCollection+":created", r.Created, r.Id)
  	_ = conn.Send("ZADD", db.ReadingsCollection+":device:"+r.Device, r.Created, r.Id)
  	_ = conn.Send("ZADD", db.ReadingsCollection+":name:"+r.Name, r.Created, r.Id)
  	if tx {
  		_, err = conn.Do("EXEC")
  	}
  
  	return r.Id, err
  }
docs: // Add a reading to the database