knex-types icon indicating copy to clipboard operation
knex-types copied to clipboard

Support for domains

Open NBprojekt opened this issue 2 years ago • 0 comments

In my database I use custom domain like:

Create Domain email As text;
Create Domain phone_number As varChar(16);

Currently when I generate the types, it seams to work in general but fails for arrays.

In this example all columns are from type email or email[]

SQL
Create Table private.email (
  email_from                    email           not null,
  email_reply_to               email               null,
  email_to                      email[]         not null,
  email_cc                      email[]             null,
  email_bcc                     email[]             null,

TS
export type PrivateEmail = {
  from: string; 
  reply_to: string | null;
  to: unknown[];
  cc: unknown[] | null;

In my opinion, it would be a nice addition if the domain got its own type. e.g.

SQL
Create Domain email As text;

TS
export type email = string;

NBprojekt avatar Mar 09 '22 10:03 NBprojekt