code: func compare(t Type, a, b interface{}) int {
  	switch t {
  	case TUUID:
  		// TODO: make sure if comparison for UUID like below makes sense.
  		return strings.Compare(string(a.(UUID)), string(b.(UUID)))
  	case Int64:
  		return int(a.(int64) - b.(int64))
  	case Int32:
  		return int(a.(int32) - b.(int32))
  	case String:
  		return strings.Compare(a.(string), b.(string))
  	case Blob:
  		return bytes.Compare(a.([]byte), b.([]byte))
  	case Bool:
  		// TODO: we don't need to order bools for range query and should report error if people do dumb things
  		var ia, ib int
  		if a.(bool) {
  			ia = 1
  		}
  		if b.(bool) {
  			ib = 1
  		}
  		return ia - ib
  	case Double:
  		fa := a.(float64)
  		fb := b.(float64)
  		if fa < fb {
  			return -1
  		}
  		if fa > fb {
  			return 1
  		}
  		return 0
  	case Timestamp:
  		ta := a.(time.Time)
  		tb := b.(time.Time)
  		if ta.Before(tb) {
  			return -1
  		}
  		if ta.After(tb) {
  			return 1
  		}
  		return 0
  	}
  	panic("invalid type") // shouldn't reach here
  }
docs: // compare compares two values; return 0 if equal, -1 if <, 1 if >.
  // Assumes args are valid.