PageSourceSearch

https://kysely.dev/assets/js/387834bb.9bedb594.js

js kysely.dev collected 2026-10-02 02:58:21 UTC 3,410 bytes, 1 lines download raw bytes

1"use strict";(globalThis.webpackChunkkysely_site=globalThis.webpackChunkkysely_site||[]).push([[6246],{5402(e,s,t){t.r(s),t.d(s,{assets:()=>c,contentTitle:()=>a,default:()=>u,frontMatter:()=>o,metadata:()=>n,toc:()=>d});const n=JSON.parse('{"id":"examples/insert/multiple-rows","title":"Multiple rows","description":"On dialects that support it (for example PostgreSQL) you can insert multiple","source":"@site/docs/examples/insert/0020-multiple-rows.mdx","sourceDirName":"examples/insert","slug":"/examples/insert/multiple-rows","permalink":"/docs/examples/insert/multiple-rows","draft":false,"unlisted":false,"editUrl":"https://github.com/kysely-org/kysely/tree/master/site/docs/examples/insert/0020-multiple-rows.mdx","tags":[],"version":"current","sidebarPosition":20,"frontMatter":{"title":"Multiple rows"},"sidebar":"tutorialSidebar","previous":{"title":"Single row","permalink":"/docs/examples/insert/single-row"},"next":{"title":"Returning data","permalink":"/docs/examples/insert/returning-data"}}');var i=t(1058),r=t(4801),l=t(2360);const o={title:"Multiple rows"},a="Multiple rows",c={},d=[];function h(e){const s={a:"a",admonition:"admonition",code:"code",em:"em",h1:"h1",header:"header",li:"li",p:"p",ul:"ul",...(0,r.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(s.header,{children:(0,i.jsx)(s.h1,{id:"multiple-rows",children:"Multiple rows"})}),"\n",(0,i.jsxs)(s.p,{children:["On dialects that support it (for example PostgreSQL) you can insert multiple\nrows by providing an array. Note that the return value is once again very\ndialect-specific. Some databases may only return the id of the ",(0,i.jsx)(s.em,{children:"last"})," inserted\nrow and some return nothing at all unless you call ",(0,i.jsx)(s.code,{children:"returning"}),"."]}),"\n","\n","\n",(0,i.jsx)("div",{style:{marginBottom:"1em"},children:(0,i.jsx)(l.Q,{code:"await db\n  .insertInto('person')\n  .values([{\n    first_name: 'Jennifer',\n    last_name: 'Aniston',\n    age: 40,\n  }, {\n    first_name: 'Arnold',\n    last_name: 'Schwarzenegger',\n    age: 70,\n  }])\n  .execute()"})}),"\n",(0,i.jsxs)(s.admonition,{title:"More examples",type:"info",children:[(0,i.jsxs)(s.p,{children:["The API documentation is packed with examples. The API docs are hosted ",(0,i.jsx)(s.a,{href:"https://kysely-org.github.io/kysely-apidoc/",children:"here"}),",\nbut you can access the same documentation by hovering over functions/methods/classes in your IDE. The examples are always\njust one hover away!"]}),(0,i.jsx)(s.p,{children:"For example, check out these sections:"}),(0,i.jsxs)(s.ul,{children:["\n",(0,i.jsx)(s.li,{children:(0,i.jsx)(s.a,{href:"https://kysely-org.github.io/kysely-apidoc/classes/InsertQueryBuilder.html#values",children:"values method"})}),"\n",(0,i.jsx)(s.li,{children:(0,i.jsx)(s.a,{href:"https://kysely-org.github.io/kysely-apidoc/classes/InsertQueryBuilder.html#onConflict",children:"onConflict method"})}),"\n",(0,i.jsx)(s.li,{children:(0,i.jsx)(s.a,{href:"https://kysely-org.github.io/kysely-apidoc/classes/InsertQueryBuilder.html#returning",children:"returning method"})}),"\n",(0,i.jsx)(s.li,{children:(0,i.jsx)(s.a,{href:"https://kysely-org.github.io/kysely-apidoc/classes/Kysely.html#insertInto",children:"insertInto method"})}),"\n"]})]})]})}function u(e={}){const{wrapper:s}={...(0,r.R)(),...e.components};return s?(0,i.jsx)(s,{...e,children:(0,i.jsx)(h,{...e})}):h(e)}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.