INSERT

const result = await client.insert({
   insert: {
       name: 'Matterhorn',
       height: 4478,
       country: 'CH',
   },
   into: table(Mountain),
});
// sql: INSERT INTO "Mountain" ("name", "height", "country") VALUES ('Matterhorn', 4478, 'CH')
//
// const result: { insertedRows: number }
const result = await client.insert({
   insert: [{
       name: 'Matterhorn',
       height: 4478,
       country: 'CH',
   }, {
       name: 'Albis',
       height: 914.6,
       country: 'CH',
   }],
   into: table(Mountain),
});
// sql: INSERT INTO "Mountain" ("name", "height", "country") VALUES ('Matterhorn', 4478, 'CH'), ('Albis', 914.6, 'CH')
//
// const result: { insertedRows: number }

Last updated