@aws-amplify/graphql-schema-generator
Version:
Amplify GraphQL schema generator
57 lines • 1.87 kB
TypeScript
import { Field, FieldType, Index } from '../schema-representation';
import { StringDataSourceAdapter } from './string-datasource-adapter';
export interface MySQLIndex {
tableName: string;
nonUnique: number;
indexName: string;
sequence: number;
columnName: string;
nullable: boolean;
}
export interface MySQLColumn {
tableName: string;
columnName: string;
sequence: number;
default: string;
datatype: string;
columnType: string;
nullable: boolean;
length: number | null | undefined;
}
type MySQLSchema = MySQLSchemaField[];
type MySQLSchemaField = {
TABLE_NAME: string;
COLUMN_NAME: string;
COLUMN_DEFAULT: string;
ORDINAL_POSITION: string;
DATA_TYPE: string;
COLUMN_TYPE: string;
IS_NULLABLE: string;
CHARACTER_MAXIMUM_LENGTH: string;
INDEX_NAME: string;
NON_UNIQUE: string;
SEQ_IN_INDEX: string;
NULLABLE: string;
};
export declare class MySQLStringDataSourceAdapter extends StringDataSourceAdapter {
private dbBuilder;
private indexes;
private fields;
private tables;
private enums;
private readonly PRIMARY_KEY_INDEX_NAME;
protected setSchema(schema: MySQLSchema): void;
protected validateSchema(schema: any[]): schema is MySQLSchema;
protected setFields(parsedSchema: MySQLSchema): void;
protected setIndexes(parsedSchema: MySQLSchema): void;
protected setTables(parsedSchema: MySQLSchema): void;
getTablesList(): string[];
getFields(tableName: string): Field[];
getPrimaryKey(tableName: string): Index | null;
getIndexes(tableName: string): Index[];
mapDataType(datatype: string, nullable: boolean, tableName: string, fieldName: string, columntype: string): FieldType;
private getEnumValues;
private generateEnumName;
}
export {};
//# sourceMappingURL=mysql-string-datasource-adapter.d.ts.map