How to use the @rmp135/sql-ts.toObject function in @rmp135/sql-ts

To help you get started, we’ve selected a few @rmp135/sql-ts examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github laurent22 / joplin / Server / tools / generate-types.ts View on Github external
async function main() {
	const definitions = await sqlts.toObject(config);

	const typeStrings = [];
	for (const table of definitions.tables) {
		typeStrings.push(createTypeString(table));
	}

	const tableStrings = [];
	for (const table of definitions.tables) {
		tableStrings.push(createRuntimeObject(table));
	}

	let content = `// Auto-generated using \`npm run generate-types\`\n${typeStrings.join('\n\n')}`;
	content += '\n\n';
	content += `export const databaseSchema:DatabaseTables = {\n${tableStrings.join('\n')}\n};`;

	insertContentIntoFile(dbFilePath, config.fileReplaceWithinMarker, config.fileReplaceWithinMarker, content);

@rmp135/sql-ts

Generate TypeScript definitions from database schemas.

MIT
Latest version published 7 months ago

Package Health Score

71 / 100
Full package analysis

Popular @rmp135/sql-ts functions

Similar packages