UNPKG

quick-erd

Version:

quick and easy text-based ERD + code generator for migration, query, typescript types and orm entity

76 lines (75 loc) 1.91 kB
import { Position } from './meta'; export declare function parse(input: string): ParseResult; export type ParseResult = { table_list: Table[]; zoom?: number; view?: Position; textBgColor?: string; textColor?: string; diagramBgColor?: string; diagramTextColor?: string; tableBgColor?: string; tableTextColor?: string; }; export declare class Parser implements ParseResult { table_list: Table[]; line_list: string[]; zoom?: number; view?: Position; textBgColor?: string; diagramTextColor?: string; textColor?: string; diagramBgColor?: string; tableBgColor?: string; tableTextColor?: string; parse(input: string): void; parseMeta(input: string): void; peekLine(): string; hasTable(): boolean | ""; parseTable(): Table; parseField(): Field; skipLine(line?: string): void; parseEmptyLine(): void; parseName(): string; parseType(): string | undefined; parseDefaultValue(): string; parseRelationType(): RelationType; parseForeignKeyReference(ref_field_name: string): ForeignKeyReference; } export type Table = { is_virtual?: boolean; name: string; field_list: Field[]; position?: { x: number; y: number; color?: string; }; }; export type Field = { name: string; type: string; is_primary_key: boolean; is_unique: boolean; is_null: boolean; is_unsigned: boolean; references: ForeignKeyReference | undefined; default_value: string | undefined; }; export type ForeignKeyReference = { type: RelationType; table: string; field: string; }; export type Relation = { from: { table: string; field: string; }; to: { table: string; field: string; }; type: RelationType; }; export type RelationType = '|' | '-<' | '>-' | '>-<' | '-0' | '0-' | '0-0' | '-0<' | '>0-';