Open creotip opened 1 month ago
I'm also stuck with no support for custom fields. In my case I'm trying to simply define some postgres like types, such as:
export const tstzrange = customType<TsTzRange>({
dataType() {
return "tstzrange";
},
toDriver(value: TsTzRange["data"]): string {
return `[${value.from},${value.to})`;
},
fromDriver(value: string): TsTzRange["data"] {
const [from, to] = value.slice(1, -1).split(",");
return {
from,
to,
};
},
});
but I get
/node_modules/src/util/type-converter/index.ts:121
throw new Error(`Drizzle-GraphQL Error: Type ${column.dataType} is not implemented!`);
^
Error: Drizzle-GraphQL Error: Type custom is not implemented!
Is it something I'm doing wrong or simply there's still not a support for this use case? Any idea how to move forward?
@chemalopezp I forked the repo and added support for array of objects and partial support for custom fields. Will push PR soon.
@ruslan-primesec that's amazing! Thank you so much, let me know if I can be of any help 🎉 Looking forward to test it ;)
@ruslan-primesec I hope everything is going well! Is there any way I could help with the custom fields PR? Or do you already have a timeline? Thank you so much!
Seems like there is no easy way to define a field as array of objects. one way is to define with
jsonb
:Checking Apollo sandbox Introspection Schema. drizzle-graphql generates the following SDL schema:
So, the mutation will accept String only:
Checking in drizzle studio. the record has been created:
Now, lets execute the query:
And here is the error:
Tried to fix it with custom field:
But there is no support for custom field:
https://github.com/drizzle-team/drizzle-graphql/blob/c558249fadcc7bd1af8ec17faf292d8cf2d365c5/src/util/type-converter/index.ts#L121