import { QueryEngine } from '@synthql/backend';
import { from } from './generated';
export const queryEngine = new QueryEngine({
url: 'postgresql://user:password@localhost:5432/dbname',
});
const query = from('films')
.columns('id', 'title', 'year')
.filter({ id: { in: [1, 2, 3] } })
.all();
const data = await queryEngine.executeAndWait(query);
// `data` will resolve to:
[
{
id: 1,
title: 'The Lord of the Rings: The Fellowship of the Ring',
year: '2001',
},
{
id: 2,
title: 'The Lord of the Rings: The Two Towers',
year: '2002',
},
{
id: 3,
title: 'The Lord of the Rings: The Return of the King',
year: '2003',
},
];
-
Notifications
You must be signed in to change notification settings - Fork 0
A fullstack, type-safe client for your PostgreSQL database
synthql/SynthQL
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
A fullstack, type-safe client for your PostgreSQL database