firefly-common GitHub

PR #114 log out body in trace level
Signed-off-by: Chengxuan Xing <chengxuan.xing@kaleido.io>
Created At 2023-12-05 08:37:57 +0000 UTC
PR #113 Add JSON serialization of filters for building more complex queries
### Primary change The URL query parameter spelling is designed to be convenient for simple cases, but it gets awkward with complex cases. This PR proposes a JSON payload format and a utility to convert that into a runtime filter. There are loads of ways this could be spelt (and many contrasting examples out there from other projects), with various compromises... the one I picked in this proposal was mainly for ease of implementation with our existing filtering code. Some of the most significant choices/characteristics: - Operators are the parent, values and modifiers are the children: - ... so `tag != 'abc'` is spelt `equal: [{not: true, field: "tag", value: "abc"}]` - Field names are always in a `field` property - never a key name - Operator -> array of matches semantics (makes it very easy to parse in Go strong typing) - `AND` combination is the standard for all operator arrays, and when multiple operators used - `OR` has to be specified explicitly, and the containing entries are all implicit `AND` (although singulars are optimized out) ### Minor other proposals in PR - Reducing `debug` logging to one line per SQL execution - Apart from in the case of `CRUD.GetMany()` where we still have two, but the 2nd includes the count returned - Relaxing the requirement on the `eventstreams` package to require IDs to be UUIDs - This matches then the CRUD package ### Example (from test) ```js { "skip": 5, "limit": 10, "sort": [ "tag", "-sequence" ], "equal": [ { "field": "tag", "value": "a" } ], "greaterThan": [ { "field": "sequence", "value": 10 } ], "or": [ { "equal": [ { "field": "masked", "value": true } ], "in": [ { "field": "tag", "values": [ "a", "b", "c" ] } ] }, { "equal": [ { "field": "masked", "value": false } ] } ] } ``` ### The AND/OR this results in ``` ( tag == 'a' ) AND ( sequence >> 10 ) AND ( ( ( masked == true ) AND ( tag IN ['a','b','c'] ) ) OR ( masked == false ) ) sort=tag,-sequence skip=5 limit=10 ```
Created At 2023-12-03 05:27:48 +0000 UTC
PR #112 Fix docs regression in parameter descriptions that changes swagger gen
We're incorrectly adding a `[0]` to these messages after #107: ``` description: 'The maximum number of records to return (max: [0])' ^^^ ```
Created At 2023-11-29 16:26:32 +0000 UTC