Closed MrVhek closed 5 months ago
All kysely knows about your schema and available columns is in the type-level. Since the types get completely erased during compilation to JavaScript, there's no way kysely can do that. You need to check against a list of fields you maintain separately in the code.
I want to be able to use dynamic orderBy expression on kysely on my API with an attribute given by user, for that purpose I need to verify that the string given of format modelName.modelField is a valid model and attribute, how can I achieve that ?
I've tried using generic typing function<DB, TB keyof DB>(modelName: string, modelField: string) but I can't test it easily ? Is there any way of doing this ?
Thanks !