Skip to content

Instantly share code, notes, and snippets.

@PaulieScanlon
Created April 25, 2024 19:42
Show Gist options
  • Save PaulieScanlon/4f3b52738108dd2e4acff11ba6ce150b to your computer and use it in GitHub Desktop.
Save PaulieScanlon/4f3b52738108dd2e4acff11ba6ce150b to your computer and use it in GitHub Desktop.
pg-to-ts generated types
// ./pg-to-ts-db.d.ts
// Table users
export interface Users {
id: number;
first_name: string;
last_name: string;
email: string;
country: string | null;
}
export interface UsersInput {
id?: number;
first_name: string;
last_name: string;
email: string;
country?: string | null;
}
const users = {
tableName: 'users',
columns: ['id', 'first_name', 'last_name', 'email', 'country'],
requiredForInsert: ['first_name', 'last_name', 'email'],
primaryKey: 'id',
foreignKeys: {},
$type: null as unknown as Users,
$input: null as unknown as UsersInput
} as const;
export interface TableTypes {
users: {
select: Users;
input: UsersInput;
};
}
export const tables = {
users,
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment