Closed tramchamploo closed 9 years ago
Thanks for the cleanup - I'll merge it now, could you add your name to AUTHORS too? Or I can add it for you if you tell me.
You doing it will be ok, thanks.
Sure! Is it your username? How do you format it - Tram Champloo? Sorry for not recognising.
BTW this doesn't actually compile for me:
[error] /Users/stephenmcd/dev/curiodb/src/main/scala/Data.scala:136: could not find implicit value for evidence parameter of type Numeric[Any]
[error] def set(arg: Any): String = {val x = numberToString(arg); value(args(0)) = x; x}
[error] ^
[error] one error found
[error] (root/compile:compile) Compilation failed
arg is always a string. Sorry for mine doesn't work. But the redis behaves this: 127.0.0.1:6379> hset hash foo 1.0 (integer) 1 127.0.0.1:6379> hgetall hash 1) "foo" 2) "1.0" 127.0.0.1:6379> hset hash foo 1.00 (integer) 0 127.0.0.1:6379> hgetall hash 1) "foo" 2) "1.00"
which is different from curiodb, so maybe just forget about tailing zeros.
The intention was for commands like HINCRBYFLOAT
and other INCR
type commands (and also sorted set scores) to mimic Redis, eg:
127.0.0.1:6379> hset xx 1 xx
(integer) 1
127.0.0.1:6379> hgetall xx
1) "1"
2) "xx"
127.0.0.1:6379> hincrbyfloat xx xx 1
"1"
127.0.0.1:6379> hincrbyfloat xx xx 1
"2"
127.0.0.1:6379> hincrbyfloat xx xx 1.1
"3.1"
127.0.0.1:6379> hincrbyfloat xx xx 1.9
"5"
Redis always outputs floats as strings (according to Redis Protocol which has a notion of ints, but not floats), and always strips trailing zeros. Of course in hashes (in CurioDB at least) the hash's values are always strings - so I think being loose with type safety here actually mimics Redis most closely.
I'll close this one for now since I think layering type info on top of everything here won't provide much benefit.
only number should be apply to this method.