edgedb-js
edgedb-js copied to clipboard
Query builder: support enum types in params
Closing because this seems to be a protocol limitation currently.
edgedb> insert NewPost {
....... title := "asdf",
....... content:= "asdf",
....... status := <NewPostStatus>$status
....... };
Unimplemented input type descriptor: Enumeration(EnumerationTypeDescriptor { id: fc8a9758-134f-11ed-913b-57df942d0b53, members: ["Published", "Draft"] })
This can be achieved by casting a string parameter to the enum type.
e.params({ status: e.str }, $ => e.insert(e.Post, {
status: e.cast(e.Status, $.status)
}))
@colinhacks I believe this issue can be closed, as the enum param works in the TS client: https://github.com/MiroslavPetrik/edgedb-vs-knex/blob/main/edgedb/src/queries/helpers/insertTaskAction.ts#L4

The error with Unimplemented input type is common - the reason is the REPL client is missing the implementations for various inputs:
https://github.com/edgedb/edgedb-cli/issues/821