MCPcopy Create free account
hub / github.com/andywer/postguard / stringifyColumnType

Function stringifyColumnType

src/parser.ts:21–36  ·  view source on GitHub ↗
(descriptor: ColumnDescriptor)

Source from the content-addressed store, hash-verified

19}
20
21function 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
38export function parseSourceFile(sourceFile: SourceFile) {
39 debugFile(`Start parsing file ${sourceFile.filePath}`)

Callers 1

parseSourceFileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected