tidwall cf7f49fd9b Add field path queries for json and comparison operators
It's now possible to query a JSON field using a GJSON path.

   SET fleet truck1 FIELD props '{"speed":58,"name":"Andy"}' POINT 33 -112

You can then use the GJSON type path to return the objects that match the WHERE.

   SCAN fleet WHERE props.speed 50 inf
   SCAN fleet WHERE props.name Andy Andy

Included in this commit is support for '==', '<', '>', '<=', '>=', and '!='.
The previous queries could be written like:

    SCAN fleet WHERE props.speed > 50
    SCAN fleet WHERE props.name == Andy
2022-10-20 11:17:01 -07:00
..
2021-09-29 07:19:00 -07:00
2021-07-31 07:42:58 -07:00
2022-09-27 10:06:47 -07:00
2022-09-27 10:06:47 -07:00
2022-09-27 14:19:57 -07:00
2022-09-23 07:30:03 -07:00
2022-09-26 13:26:46 -07:00
2022-09-27 14:06:24 -07:00
2022-09-26 13:26:46 -07:00
2022-09-26 13:26:46 -07:00
2022-09-26 13:26:46 -07:00
2022-09-24 13:41:36 -07:00
2022-09-27 10:06:47 -07:00
2022-09-27 14:06:24 -07:00
2022-09-26 13:26:46 -07:00
2022-09-26 13:26:46 -07:00
2022-09-27 08:18:17 -07:00
2022-09-27 14:42:52 -07:00
2022-09-26 13:26:46 -07:00

Tile38 Integation Testing

  • Uses Redis protocol
  • The Tile38 data is flushed before every DoBatch

A basic test operation looks something like:

func keys_SET_test(mc *mockServer) error {
	return mc.DoBatch([][]interface{}{
        {"SET", "fleet", "truck1", "POINT", 33.0001, -112.0001}, {"OK"},
        {"GET", "fleet", "truck1", "POINT"}, {"[33.0001 -112.0001]"},
    }
}

Using a custom function:

func keys_MATCH_test(mc *mockServer) error {
	return mc.DoBatch([][]interface{}{
        {"SET", "fleet", "truck1", "POINT", 33.0001, -112.0001}, {
            func(v interface{}) (resp, expect interface{}) {
                // v is the value as strings or slices of strings
                // test will pass as long as `resp` and `expect` are the same.
                return v, "OK"
            },
		},
    }
}