| 19 | } |
| 20 | |
| 21 | function stringifyColumnType(descriptor: ColumnDescriptor) { |
| 22 | const props: string[] = [ |
| 23 | descriptor.hasDefault ? "default value" : null, |
| 24 | descriptor.nullable ? "nullable" : null |
| 25 | ].filter(str => !!str) as string[] |
| 26 | |
| 27 | const propsString = props.length > 0 ? ` (${props.join(", ")})` : "" |
| 28 | |
| 29 | if (descriptor.type === "enum" && descriptor.enum) { |
| 30 | return `enum${propsString} [${descriptor.enum.map(value => `'${value}'`).join(", ")}]` |
| 31 | } else { |
| 32 | return `${descriptor.type}${ |
| 33 | descriptor.subtype ? `[${descriptor.subtype.type}]` : "" |
| 34 | }${propsString}` |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | export function parseSourceFile(sourceFile: SourceFile) { |
| 39 | debugFile(`Start parsing file ${sourceFile.filePath}`) |