(type, database, q)
| 219 | } |
| 220 | |
| 221 | function toTypeDefinition(type, database, q) { |
| 222 | if (!type || !databases[database]?.hasTypes) return null; |
| 223 | const fields = (type.fields || []) |
| 224 | .map((f) => `\t${q(f.name)} ${f.type}`) |
| 225 | .join(",\n"); |
| 226 | let s = `CREATE TYPE ${q(type.name)} AS (\n${fields}\n);`; |
| 227 | if (type.comment?.trim()) { |
| 228 | s += `\nCOMMENT ON TYPE ${q(type.name)} IS '${escapeQuotes(type.comment)}';`; |
| 229 | } |
| 230 | return s; |
| 231 | } |
| 232 | |
| 233 | function toEnumDefinition(e, database, q) { |
| 234 | if (!e || !databases[database]?.hasEnums) return null; |
no test coverage detected