@aws-amplify/graphql-schema-generator
Version:
Amplify GraphQL schema generator
57 lines • 1.96 kB
TypeScript
import { Field, FieldType, Index } from '../schema-representation';
import { StringDataSourceAdapter } from './string-datasource-adapter';
export interface PostgresIndex {
tableName: string;
indexName: string;
columns: string[];
constraintType: string;
}
export interface PostgresColumn {
tableName: string;
columnName: string;
sequence: number;
default: string;
datatype: string;
columnType: string;
nullable: boolean;
length: number | null | undefined;
}
type PostgresSchema = PostgresSchemaField[];
type PostgresSchemaField = {
enum_name: string;
enum_values: string;
table_name: string;
column_name: string;
column_default: string;
ordinal_position: number;
data_type: string;
udt_name: string;
is_nullable: string;
character_maximum_length: number;
index_columns: string;
indexname: string;
constraint_type: string;
};
export declare const expectedColumns: string[];
export declare class PostgresStringDataSourceAdapter extends StringDataSourceAdapter {
private dbBuilder;
private indexes;
private fields;
private tables;
private enums;
private readonly PRIMARY_KEY_INDEX_NAME;
protected setSchema(schema: PostgresSchema): void;
protected validateSchema(schema: any[]): schema is PostgresSchema;
getTablesList(): string[];
getFields(tableName: string): Field[];
getPrimaryKey(tableName: string): Index | null;
getIndexes(tableName: string): Index[];
private generateEnumName;
protected setEnums(parsedSchema: PostgresSchema): void;
protected setTables(parsedSchema: PostgresSchema): void;
protected setFields(fields: PostgresSchema): void;
protected setIndexes(indexes: PostgresSchema): void;
mapDataType(datatype: string, nullable: boolean, tableName: string, fieldName: string, columntype: string): FieldType;
}
export {};
//# sourceMappingURL=pg-string-datasource-adapter.d.ts.map