Open iwilltry42 opened 2 months ago
Happy to surprise you 😅
I actually would vote against using a JSON string as a function parameter - I feel like accepting such is more on the user interface's side, e.g. in a CLI or whatever UI.
As a library/module I think it should use proper types.
Though we could provide a QueryJSON
(I'm bad at naming) func that implements your suggestion.
But that's all up to you :)
FWIW I'm not sure about the Value
and WhereDocuments
fields - we could use any
and accept either there to reduce it to a single field.
That would be more abstract.
Sorry for the late response! The breaking change was holding me back from merging because all other changes since the last release were without breaking changes. And for releasing a version before merging, the decision regarding the Vertex options passing held me back. :grimacing:
Both are done now, so I'm open to some breaking changes (not only from this PR but also other changes) in the next release.
Having a separate method for passing the query as JSON is a good idea :+1:. I'll look into adding that as soon as this one is merged.
Regarding the Value
and WhereDocuments
as any
I'll think a bit about it.
Top-Level
WhereDocument
structs areAND
ed. AWhereDocument
can be a singular operator like$contains
or$not_contains
, which require aValue
to be set.$or
and$and
require nestedWhereDocument
sI'm sure this could be done without a struct and using some
map[string]any
andreflect
logic, but this feels cleaner, though breaking.Let me know what you think!