ts-sql-codegen
Version:
Generates ts-sql-query table mappings from tbls schema output
275 lines (274 loc) • 9.09 kB
TypeScript
import * as z from "zod";
export declare const ColumnSchema: z.ZodObject<{
name: z.ZodString;
type: z.ZodString;
nullable: z.ZodOptional<z.ZodBoolean>;
default: z.ZodOptional<z.ZodNullable<z.ZodAny>>;
comment: z.ZodOptional<z.ZodNullable<z.ZodString>>;
}, "strip", z.ZodTypeAny, {
type: string;
name: string;
comment?: string | null | undefined;
nullable?: boolean | undefined;
default?: any;
}, {
type: string;
name: string;
comment?: string | null | undefined;
nullable?: boolean | undefined;
default?: any;
}>;
export type Column = z.TypeOf<typeof ColumnSchema>;
export declare const ConstraintSchema: z.ZodObject<{
name: z.ZodString;
type: z.ZodString;
table: z.ZodString;
columns: z.ZodArray<z.ZodString, "many">;
referencedTable: z.ZodOptional<z.ZodNullable<z.ZodString>>;
referencedColumns: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
comment: z.ZodOptional<z.ZodNullable<z.ZodString>>;
}, "strip", z.ZodTypeAny, {
type: string;
name: string;
table: string;
columns: string[];
comment?: string | null | undefined;
referencedTable?: string | null | undefined;
referencedColumns?: string[] | null | undefined;
}, {
type: string;
name: string;
table: string;
columns: string[];
comment?: string | null | undefined;
referencedTable?: string | null | undefined;
referencedColumns?: string[] | null | undefined;
}>;
export declare const TableSchema: z.ZodObject<{
name: z.ZodString;
type: z.ZodString;
columns: z.ZodArray<z.ZodObject<{
name: z.ZodString;
type: z.ZodString;
nullable: z.ZodOptional<z.ZodBoolean>;
default: z.ZodOptional<z.ZodNullable<z.ZodAny>>;
comment: z.ZodOptional<z.ZodNullable<z.ZodString>>;
}, "strip", z.ZodTypeAny, {
type: string;
name: string;
comment?: string | null | undefined;
nullable?: boolean | undefined;
default?: any;
}, {
type: string;
name: string;
comment?: string | null | undefined;
nullable?: boolean | undefined;
default?: any;
}>, "many">;
constraints: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
name: z.ZodString;
type: z.ZodString;
table: z.ZodString;
columns: z.ZodArray<z.ZodString, "many">;
referencedTable: z.ZodOptional<z.ZodNullable<z.ZodString>>;
referencedColumns: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
comment: z.ZodOptional<z.ZodNullable<z.ZodString>>;
}, "strip", z.ZodTypeAny, {
type: string;
name: string;
table: string;
columns: string[];
comment?: string | null | undefined;
referencedTable?: string | null | undefined;
referencedColumns?: string[] | null | undefined;
}, {
type: string;
name: string;
table: string;
columns: string[];
comment?: string | null | undefined;
referencedTable?: string | null | undefined;
referencedColumns?: string[] | null | undefined;
}>, "many">>>;
comment: z.ZodOptional<z.ZodNullable<z.ZodString>>;
}, "strip", z.ZodTypeAny, {
type: string;
name: string;
columns: {
type: string;
name: string;
comment?: string | null | undefined;
nullable?: boolean | undefined;
default?: any;
}[];
comment?: string | null | undefined;
constraints?: {
type: string;
name: string;
table: string;
columns: string[];
comment?: string | null | undefined;
referencedTable?: string | null | undefined;
referencedColumns?: string[] | null | undefined;
}[] | null | undefined;
}, {
type: string;
name: string;
columns: {
type: string;
name: string;
comment?: string | null | undefined;
nullable?: boolean | undefined;
default?: any;
}[];
comment?: string | null | undefined;
constraints?: {
type: string;
name: string;
table: string;
columns: string[];
comment?: string | null | undefined;
referencedTable?: string | null | undefined;
referencedColumns?: string[] | null | undefined;
}[] | null | undefined;
}>;
export type Table = z.TypeOf<typeof TableSchema>;
export declare const TblsSchema: z.ZodObject<{
name: z.ZodString;
tables: z.ZodArray<z.ZodObject<{
name: z.ZodString;
type: z.ZodString;
columns: z.ZodArray<z.ZodObject<{
name: z.ZodString;
type: z.ZodString;
nullable: z.ZodOptional<z.ZodBoolean>;
default: z.ZodOptional<z.ZodNullable<z.ZodAny>>;
comment: z.ZodOptional<z.ZodNullable<z.ZodString>>;
}, "strip", z.ZodTypeAny, {
type: string;
name: string;
comment?: string | null | undefined;
nullable?: boolean | undefined;
default?: any;
}, {
type: string;
name: string;
comment?: string | null | undefined;
nullable?: boolean | undefined;
default?: any;
}>, "many">;
constraints: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
name: z.ZodString;
type: z.ZodString;
table: z.ZodString;
columns: z.ZodArray<z.ZodString, "many">;
referencedTable: z.ZodOptional<z.ZodNullable<z.ZodString>>;
referencedColumns: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
comment: z.ZodOptional<z.ZodNullable<z.ZodString>>;
}, "strip", z.ZodTypeAny, {
type: string;
name: string;
table: string;
columns: string[];
comment?: string | null | undefined;
referencedTable?: string | null | undefined;
referencedColumns?: string[] | null | undefined;
}, {
type: string;
name: string;
table: string;
columns: string[];
comment?: string | null | undefined;
referencedTable?: string | null | undefined;
referencedColumns?: string[] | null | undefined;
}>, "many">>>;
comment: z.ZodOptional<z.ZodNullable<z.ZodString>>;
}, "strip", z.ZodTypeAny, {
type: string;
name: string;
columns: {
type: string;
name: string;
comment?: string | null | undefined;
nullable?: boolean | undefined;
default?: any;
}[];
comment?: string | null | undefined;
constraints?: {
type: string;
name: string;
table: string;
columns: string[];
comment?: string | null | undefined;
referencedTable?: string | null | undefined;
referencedColumns?: string[] | null | undefined;
}[] | null | undefined;
}, {
type: string;
name: string;
columns: {
type: string;
name: string;
comment?: string | null | undefined;
nullable?: boolean | undefined;
default?: any;
}[];
comment?: string | null | undefined;
constraints?: {
type: string;
name: string;
table: string;
columns: string[];
comment?: string | null | undefined;
referencedTable?: string | null | undefined;
referencedColumns?: string[] | null | undefined;
}[] | null | undefined;
}>, "many">;
}, "strip", z.ZodTypeAny, {
name: string;
tables: {
type: string;
name: string;
columns: {
type: string;
name: string;
comment?: string | null | undefined;
nullable?: boolean | undefined;
default?: any;
}[];
comment?: string | null | undefined;
constraints?: {
type: string;
name: string;
table: string;
columns: string[];
comment?: string | null | undefined;
referencedTable?: string | null | undefined;
referencedColumns?: string[] | null | undefined;
}[] | null | undefined;
}[];
}, {
name: string;
tables: {
type: string;
name: string;
columns: {
type: string;
name: string;
comment?: string | null | undefined;
nullable?: boolean | undefined;
default?: any;
}[];
comment?: string | null | undefined;
constraints?: {
type: string;
name: string;
table: string;
columns: string[];
comment?: string | null | undefined;
referencedTable?: string | null | undefined;
referencedColumns?: string[] | null | undefined;
}[] | null | undefined;
}[];
}>;