[{"data":1,"prerenderedAt":1749},["ShallowReactive",2],{"navigation_docs_en":3,"-en-tauri-sqlite-orm-querying-data-selecting-data":237,"-en-tauri-sqlite-orm-querying-data-selecting-data-surround":1744},[4,15,69,122],{"title":5,"icon":6,"path":7,"stem":8,"children":9,"page":14},"Getting Started with Docs","i-lucide-home","/en/getting-started","en/1.getting-started",[10],{"title":11,"path":12,"stem":13,"icon":6},"Introduction","/en/getting-started/introduction","en/1.getting-started/1.introduction",false,{"title":16,"path":17,"stem":18,"children":19,"page":14},"owo-ui Components","/en/owo-ui-components","en/2.owo-ui-components",[20,23],{"title":11,"path":21,"stem":22,"icon":6},"/en/owo-ui-components/introduction","en/2.owo-ui-components/2.introduction",{"title":24,"icon":25,"path":26,"stem":27,"children":28,"page":14},"Components","i-lucide-layout","/en/owo-ui-components/components","en/2.owo-ui-components/3.components",[29,33,37,41,45,49,53,57,61,65],{"title":30,"path":31,"stem":32},"Button","/en/owo-ui-components/components/button","en/2.owo-ui-components/3.components/button",{"title":34,"path":35,"stem":36},"Checkbox","/en/owo-ui-components/components/checkbox","en/2.owo-ui-components/3.components/checkbox",{"title":38,"path":39,"stem":40},"Collapsible Container","/en/owo-ui-components/components/collapsible-container","en/2.owo-ui-components/3.components/collapsible-container",{"title":42,"path":43,"stem":44},"Dropdown","/en/owo-ui-components/components/dropdown","en/2.owo-ui-components/3.components/dropdown",{"title":46,"path":47,"stem":48},"Flow Layout","/en/owo-ui-components/components/flow-layout","en/2.owo-ui-components/3.components/flow-layout",{"title":50,"path":51,"stem":52},"Grid Layout","/en/owo-ui-components/components/grid-layout","en/2.owo-ui-components/3.components/grid-layout",{"title":54,"path":55,"stem":56},"Label","/en/owo-ui-components/components/label","en/2.owo-ui-components/3.components/label",{"title":58,"path":59,"stem":60},"Scroll Container","/en/owo-ui-components/components/scroll-container","en/2.owo-ui-components/3.components/scroll-container",{"title":62,"path":63,"stem":64},"Slider","/en/owo-ui-components/components/slider","en/2.owo-ui-components/3.components/slider",{"title":66,"path":67,"stem":68},"Templates","/en/owo-ui-components/components/templates","en/2.owo-ui-components/3.components/templates",{"title":70,"path":71,"stem":72,"children":73,"page":14},"Nexus","/en/nexus","en/3.nexus",[74,77,82],{"title":11,"path":75,"stem":76,"icon":6},"/en/nexus/introduction","en/3.nexus/2.introduction",{"title":78,"path":79,"stem":80,"icon":81},"Deployment","/en/nexus/deployment","en/3.nexus/3.deployment","i-lucide-rocket",{"title":83,"path":84,"stem":85,"children":86,"page":14},"Endpoints","/en/nexus/endpoints","en/3.nexus/endpoints",[87,91,95,99,102,106,110,114,118],{"title":88,"path":89,"stem":90},"Authentication","/en/nexus/endpoints/authentication","en/3.nexus/endpoints/1.authentication",{"title":92,"path":93,"stem":94},"Rate Limiting","/en/nexus/endpoints/rate-limiting","en/3.nexus/endpoints/2.rate-limiting",{"title":96,"path":97,"stem":98},"Error Handling","/en/nexus/endpoints/error-handling","en/3.nexus/endpoints/3.error-handling",{"title":83,"path":100,"stem":101},"/en/nexus/endpoints/_dir","en/3.nexus/endpoints/_dir",{"title":103,"path":104,"stem":105},"Album","/en/nexus/endpoints/albums","en/3.nexus/endpoints/albums",{"title":107,"path":108,"stem":109},"Blog","/en/nexus/endpoints/blog","en/3.nexus/endpoints/blog",{"title":111,"path":112,"stem":113},"Comments","/en/nexus/endpoints/comments","en/3.nexus/endpoints/comments",{"title":115,"path":116,"stem":117},"File Management","/en/nexus/endpoints/file-management","en/3.nexus/endpoints/file-management",{"title":119,"path":120,"stem":121},"Photo Management","/en/nexus/endpoints/photos","en/3.nexus/endpoints/photos",{"title":123,"icon":124,"path":125,"stem":126,"children":127,"page":14},"Tauri SQLite ORM","i-lucide-database","/en/tauri-sqlite-orm","en/4.tauri-sqlite-orm",[128,132,137,141,162,187,232],{"title":11,"path":129,"stem":130,"icon":131},"/en/tauri-sqlite-orm/introduction","en/4.tauri-sqlite-orm/1.introduction","i-lucide-book-open",{"title":133,"path":134,"stem":135,"icon":136},"Installation & Setup","/en/tauri-sqlite-orm/installation-and-setup","en/4.tauri-sqlite-orm/2.installation-and-setup","i-lucide-download",{"title":138,"path":139,"stem":140,"icon":81},"Your First Schema & Query","/en/tauri-sqlite-orm/your-first-schema-and-query","en/4.tauri-sqlite-orm/3.your-first-schema-and-query",{"title":142,"path":143,"stem":144,"children":145,"page":14},"Core Concepts","/en/tauri-sqlite-orm/core-concepts","en/4.tauri-sqlite-orm/4.core-concepts",[146,150,154,158],{"title":147,"path":148,"stem":149},"Defining Schemas","/en/tauri-sqlite-orm/core-concepts/defining-schemas","en/4.tauri-sqlite-orm/4.core-concepts/1.defining-schemas",{"title":151,"path":152,"stem":153},"Column Types & Modifiers","/en/tauri-sqlite-orm/core-concepts/column-types-and-modifiers","en/4.tauri-sqlite-orm/4.core-concepts/2.column-types-and-modifiers",{"title":155,"path":156,"stem":157},"The ORM Instance","/en/tauri-sqlite-orm/core-concepts/the-orm-instance","en/4.tauri-sqlite-orm/4.core-concepts/3.the-orm-instance",{"title":159,"path":160,"stem":161},"Migrations","/en/tauri-sqlite-orm/core-concepts/migrations","en/4.tauri-sqlite-orm/4.core-concepts/4.migrations",{"title":163,"path":164,"stem":165,"children":166,"page":14},"Querying Data","/en/tauri-sqlite-orm/querying-data","en/4.tauri-sqlite-orm/5.querying-data",[167,171,175,179,183],{"title":168,"path":169,"stem":170},"Select","/en/tauri-sqlite-orm/querying-data/selecting-data","en/4.tauri-sqlite-orm/5.querying-data/1.selecting-data",{"title":172,"path":173,"stem":174},"Insert","/en/tauri-sqlite-orm/querying-data/inserting-data","en/4.tauri-sqlite-orm/5.querying-data/2.inserting-data",{"title":176,"path":177,"stem":178},"Update","/en/tauri-sqlite-orm/querying-data/updating-data","en/4.tauri-sqlite-orm/5.querying-data/3.updating-data",{"title":180,"path":181,"stem":182},"Delete","/en/tauri-sqlite-orm/querying-data/deleting-data","en/4.tauri-sqlite-orm/5.querying-data/4.deleting-data",{"title":184,"path":185,"stem":186},"Conditions & Operators","/en/tauri-sqlite-orm/querying-data/conditions-and-operators","en/4.tauri-sqlite-orm/5.querying-data/5.conditions-and-operators",{"title":188,"path":189,"stem":190,"children":191,"page":14},"Advanced Topics","/en/tauri-sqlite-orm/advanced-topics","en/4.tauri-sqlite-orm/6.advanced-topics",[192,196,200,204,208,212,216,220,224,228],{"title":193,"path":194,"stem":195},"Relations","/en/tauri-sqlite-orm/advanced-topics/working-with-relations","en/4.tauri-sqlite-orm/6.advanced-topics/1.working-with-relations",{"title":197,"path":198,"stem":199},"Error Handling & Safety","/en/tauri-sqlite-orm/advanced-topics/error-handling-and-safety","en/4.tauri-sqlite-orm/6.advanced-topics/10.error-handling-and-safety",{"title":201,"path":202,"stem":203},"Joins","/en/tauri-sqlite-orm/advanced-topics/joins","en/4.tauri-sqlite-orm/6.advanced-topics/2.joins",{"title":205,"path":206,"stem":207},"Transactions","/en/tauri-sqlite-orm/advanced-topics/transactions","en/4.tauri-sqlite-orm/6.advanced-topics/3.transactions",{"title":209,"path":210,"stem":211},"Common Table Expressions","/en/tauri-sqlite-orm/advanced-topics/common-table-expressions","en/4.tauri-sqlite-orm/6.advanced-topics/4.common-table-expressions",{"title":213,"path":214,"stem":215},"Raw SQL","/en/tauri-sqlite-orm/advanced-topics/raw-sql","en/4.tauri-sqlite-orm/6.advanced-topics/5.raw-sql",{"title":217,"path":218,"stem":219},"Type Safety & Inference","/en/tauri-sqlite-orm/advanced-topics/type-safety-and-inference","en/4.tauri-sqlite-orm/6.advanced-topics/6.type-safety-and-inference",{"title":221,"path":222,"stem":223},"Schema Management","/en/tauri-sqlite-orm/advanced-topics/manual-schema-management","en/4.tauri-sqlite-orm/6.advanced-topics/7.manual-schema-management",{"title":225,"path":226,"stem":227},"Query Debugging","/en/tauri-sqlite-orm/advanced-topics/query-debugging","en/4.tauri-sqlite-orm/6.advanced-topics/8.query-debugging",{"title":229,"path":230,"stem":231},"Subqueries & Aggregates","/en/tauri-sqlite-orm/advanced-topics/subqueries-and-aggregates","en/4.tauri-sqlite-orm/6.advanced-topics/9.subqueries-and-aggregates",{"title":233,"path":234,"stem":235,"icon":236},"API Reference","/en/tauri-sqlite-orm/api-reference","en/4.tauri-sqlite-orm/7.api-reference","i-lucide-book",{"id":238,"title":168,"body":239,"description":1738,"extension":1739,"links":1740,"meta":1741,"navigation":339,"path":169,"seo":1742,"stem":170,"__hash__":1743},"docs_en/en/4.tauri-sqlite-orm/5.querying-data/1.selecting-data.md",{"type":240,"value":241,"toc":1718},"minimark",[242,251,256,266,391,395,410,513,527,587,591,597,661,668,678,851,855,858,899,1052,1060,1066,1226,1230,1237,1240,1362,1369,1372,1485,1492,1495,1627,1631,1641,1701,1714],[243,244,245,246,250],"p",{},"The ",[247,248,249],"code",{},"db.select()"," method is your entry point for fetching data from the database. It returns a query builder that allows you to specify which columns to retrieve, how to filter, and how to order the results.",[252,253,255],"h2",{"id":254},"fetching-all-records","Fetching All Records",[243,257,258,259,261,262,265],{},"To get all rows from a table, start with ",[247,260,249],{}," and end with ",[247,263,264],{},".all()",".",[267,268,273],"pre",{"className":269,"code":270,"language":271,"meta":272,"style":272},"language-ts shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","import { db } from '$lib/db';\nimport { users } from '$lib/db/schema';\n\n// Fetches every column for every user\nconst allUsers = await db.select(users).all();\n// allUsers is typed as: { id: number; fullName: string; ... }[]\n","ts","",[247,274,275,311,334,341,348,385],{"__ignoreMap":272},[276,277,280,284,288,292,295,298,301,305,308],"span",{"class":278,"line":279},"line",1,[276,281,283],{"class":282},"s7zQu","import",[276,285,287],{"class":286},"sMK4o"," {",[276,289,291],{"class":290},"sTEyZ"," db",[276,293,294],{"class":286}," }",[276,296,297],{"class":282}," from",[276,299,300],{"class":286}," '",[276,302,304],{"class":303},"sfazB","$lib/db",[276,306,307],{"class":286},"'",[276,309,310],{"class":286},";\n",[276,312,314,316,318,321,323,325,327,330,332],{"class":278,"line":313},2,[276,315,283],{"class":282},[276,317,287],{"class":286},[276,319,320],{"class":290}," users",[276,322,294],{"class":286},[276,324,297],{"class":282},[276,326,300],{"class":286},[276,328,329],{"class":303},"$lib/db/schema",[276,331,307],{"class":286},[276,333,310],{"class":286},[276,335,337],{"class":278,"line":336},3,[276,338,340],{"emptyLinePlaceholder":339},true,"\n",[276,342,344],{"class":278,"line":343},4,[276,345,347],{"class":346},"sHwdD","// Fetches every column for every user\n",[276,349,351,355,358,361,364,366,368,372,375,377,380,383],{"class":278,"line":350},5,[276,352,354],{"class":353},"spNyl","const",[276,356,357],{"class":290}," allUsers ",[276,359,360],{"class":286},"=",[276,362,363],{"class":282}," await",[276,365,291],{"class":290},[276,367,265],{"class":286},[276,369,371],{"class":370},"s2Zo4","select",[276,373,374],{"class":290},"(users)",[276,376,265],{"class":286},[276,378,379],{"class":370},"all",[276,381,382],{"class":290},"()",[276,384,310],{"class":286},[276,386,388],{"class":278,"line":387},6,[276,389,390],{"class":346},"// allUsers is typed as: { id: number; fullName: string; ... }[]\n",[252,392,394],{"id":393},"fetching-a-single-record","Fetching a Single Record",[243,396,397,398,401,402,405,406,409],{},"If you only expect one result, chaining ",[247,399,400],{},".get()"," is more convenient. It returns the first matching record or ",[247,403,404],{},"undefined"," if no records are found. It implicitly adds ",[247,407,408],{},"LIMIT 1"," to your query.",[267,411,413],{"className":269,"code":412,"language":271,"meta":272,"style":272},"import { eq } from '@type32/tauri-sqlite-orm';\n\nconst user = await db.select(users).where(eq(users._.columns.id, 1)).get();\n// user is typed as: { id: number; fullName: string; ... } | undefined\n",[247,414,415,437,441,508],{"__ignoreMap":272},[276,416,417,419,421,424,426,428,430,433,435],{"class":278,"line":279},[276,418,283],{"class":282},[276,420,287],{"class":286},[276,422,423],{"class":290}," eq",[276,425,294],{"class":286},[276,427,297],{"class":282},[276,429,300],{"class":286},[276,431,432],{"class":303},"@type32/tauri-sqlite-orm",[276,434,307],{"class":286},[276,436,310],{"class":286},[276,438,439],{"class":278,"line":313},[276,440,340],{"emptyLinePlaceholder":339},[276,442,443,445,448,450,452,454,456,458,460,462,465,468,471,474,476,479,481,484,486,489,492,496,499,501,504,506],{"class":278,"line":336},[276,444,354],{"class":353},[276,446,447],{"class":290}," user ",[276,449,360],{"class":286},[276,451,363],{"class":282},[276,453,291],{"class":290},[276,455,265],{"class":286},[276,457,371],{"class":370},[276,459,374],{"class":290},[276,461,265],{"class":286},[276,463,464],{"class":370},"where",[276,466,467],{"class":290},"(",[276,469,470],{"class":370},"eq",[276,472,473],{"class":290},"(users",[276,475,265],{"class":286},[276,477,478],{"class":290},"_",[276,480,265],{"class":286},[276,482,483],{"class":290},"columns",[276,485,265],{"class":286},[276,487,488],{"class":290},"id",[276,490,491],{"class":286},",",[276,493,495],{"class":494},"sbssI"," 1",[276,497,498],{"class":290},"))",[276,500,265],{"class":286},[276,502,503],{"class":370},"get",[276,505,382],{"class":290},[276,507,310],{"class":286},[276,509,510],{"class":278,"line":343},[276,511,512],{"class":346},"// user is typed as: { id: number; fullName: string; ... } | undefined\n",[243,514,515,519,520,523,524,526],{},[516,517,518],"strong",{},"Tip:"," You can also use ",[247,521,522],{},".first()"," which is an alias for ",[247,525,400],{}," with clearer semantics:",[267,528,530],{"className":269,"code":529,"language":271,"meta":272,"style":272},"const user = await db.select(users).where(eq(users._.columns.id, 1)).first();\n",[247,531,532],{"__ignoreMap":272},[276,533,534,536,538,540,542,544,546,548,550,552,554,556,558,560,562,564,566,568,570,572,574,576,578,580,583,585],{"class":278,"line":279},[276,535,354],{"class":353},[276,537,447],{"class":290},[276,539,360],{"class":286},[276,541,363],{"class":282},[276,543,291],{"class":290},[276,545,265],{"class":286},[276,547,371],{"class":370},[276,549,374],{"class":290},[276,551,265],{"class":286},[276,553,464],{"class":370},[276,555,467],{"class":290},[276,557,470],{"class":370},[276,559,473],{"class":290},[276,561,265],{"class":286},[276,563,478],{"class":290},[276,565,265],{"class":286},[276,567,483],{"class":290},[276,569,265],{"class":286},[276,571,488],{"class":290},[276,573,491],{"class":286},[276,575,495],{"class":494},[276,577,498],{"class":290},[276,579,265],{"class":286},[276,581,582],{"class":370},"first",[276,584,382],{"class":290},[276,586,310],{"class":286},[252,588,590],{"id":589},"partial-select","Partial Select",[243,592,593,594,596],{},"To improve performance, it's good practice to only select the columns you need. You can do this by passing an array of column names as the second argument to ",[247,595,249],{},". The return type will automatically adjust to only include the selected fields.",[267,598,600],{"className":269,"code":599,"language":271,"meta":272,"style":272},"const userNames = await db.select(users, ['id', 'fullName']).all();\n\n// userNames is typed as: { id: number; fullName: string; }[]\n",[247,601,602,652,656],{"__ignoreMap":272},[276,603,604,606,609,611,613,615,617,619,621,623,626,628,630,632,634,636,639,641,644,646,648,650],{"class":278,"line":279},[276,605,354],{"class":353},[276,607,608],{"class":290}," userNames ",[276,610,360],{"class":286},[276,612,363],{"class":282},[276,614,291],{"class":290},[276,616,265],{"class":286},[276,618,371],{"class":370},[276,620,473],{"class":290},[276,622,491],{"class":286},[276,624,625],{"class":290}," [",[276,627,307],{"class":286},[276,629,488],{"class":303},[276,631,307],{"class":286},[276,633,491],{"class":286},[276,635,300],{"class":286},[276,637,638],{"class":303},"fullName",[276,640,307],{"class":286},[276,642,643],{"class":290},"])",[276,645,265],{"class":286},[276,647,379],{"class":370},[276,649,382],{"class":290},[276,651,310],{"class":286},[276,653,654],{"class":278,"line":313},[276,655,340],{"emptyLinePlaceholder":339},[276,657,658],{"class":278,"line":336},[276,659,660],{"class":346},"// userNames is typed as: { id: number; fullName: string; }[]\n",[252,662,664,665],{"id":663},"filtering-with-where","Filtering with ",[247,666,667],{},".where()",[243,669,245,670,672,673,265],{},[247,671,667],{}," clause filters your results. It accepts a condition object from one of the ",[674,675,677],"a",{"href":676},"/5.querying-data/5.conditions-and-operators","operators",[267,679,681],{"className":269,"code":680,"language":271,"meta":272,"style":272},"import { and, eq, like } from '@type32/tauri-sqlite-orm';\n\n// Find active users with a \".com\" email address\nconst activeUsers = await db.select(users)\n  .where(\n    and(\n      eq(users._.columns.status, 'active'),\n      like(users._.columns.email, '%.com')\n    )\n  )\n  .all();\n",[247,682,683,713,717,722,742,752,759,795,828,834,840],{"__ignoreMap":272},[276,684,685,687,689,692,694,696,698,701,703,705,707,709,711],{"class":278,"line":279},[276,686,283],{"class":282},[276,688,287],{"class":286},[276,690,691],{"class":290}," and",[276,693,491],{"class":286},[276,695,423],{"class":290},[276,697,491],{"class":286},[276,699,700],{"class":290}," like",[276,702,294],{"class":286},[276,704,297],{"class":282},[276,706,300],{"class":286},[276,708,432],{"class":303},[276,710,307],{"class":286},[276,712,310],{"class":286},[276,714,715],{"class":278,"line":313},[276,716,340],{"emptyLinePlaceholder":339},[276,718,719],{"class":278,"line":336},[276,720,721],{"class":346},"// Find active users with a \".com\" email address\n",[276,723,724,726,729,731,733,735,737,739],{"class":278,"line":343},[276,725,354],{"class":353},[276,727,728],{"class":290}," activeUsers ",[276,730,360],{"class":286},[276,732,363],{"class":282},[276,734,291],{"class":290},[276,736,265],{"class":286},[276,738,371],{"class":370},[276,740,741],{"class":290},"(users)\n",[276,743,744,747,749],{"class":278,"line":350},[276,745,746],{"class":286},"  .",[276,748,464],{"class":370},[276,750,751],{"class":290},"(\n",[276,753,754,757],{"class":278,"line":387},[276,755,756],{"class":370},"    and",[276,758,751],{"class":290},[276,760,762,765,767,769,771,773,775,777,780,782,784,787,789,792],{"class":278,"line":761},7,[276,763,764],{"class":370},"      eq",[276,766,473],{"class":290},[276,768,265],{"class":286},[276,770,478],{"class":290},[276,772,265],{"class":286},[276,774,483],{"class":290},[276,776,265],{"class":286},[276,778,779],{"class":290},"status",[276,781,491],{"class":286},[276,783,300],{"class":286},[276,785,786],{"class":303},"active",[276,788,307],{"class":286},[276,790,791],{"class":290},")",[276,793,794],{"class":286},",\n",[276,796,798,801,803,805,807,809,811,813,816,818,820,823,825],{"class":278,"line":797},8,[276,799,800],{"class":370},"      like",[276,802,473],{"class":290},[276,804,265],{"class":286},[276,806,478],{"class":290},[276,808,265],{"class":286},[276,810,483],{"class":290},[276,812,265],{"class":286},[276,814,815],{"class":290},"email",[276,817,491],{"class":286},[276,819,300],{"class":286},[276,821,822],{"class":303},"%.com",[276,824,307],{"class":286},[276,826,827],{"class":290},")\n",[276,829,831],{"class":278,"line":830},9,[276,832,833],{"class":290},"    )\n",[276,835,837],{"class":278,"line":836},10,[276,838,839],{"class":290},"  )\n",[276,841,843,845,847,849],{"class":278,"line":842},11,[276,844,746],{"class":286},[276,846,379],{"class":370},[276,848,382],{"class":290},[276,850,310],{"class":286},[252,852,854],{"id":853},"ordering-and-pagination","Ordering and Pagination",[243,856,857],{},"You can control the order and limit the number of results using these common clauses.",[859,860,861,877,889],"ul",{},[862,863,864,869,870,873,874,265],"li",{},[516,865,866],{},[247,867,868],{},".orderBy(column, direction?)",": Sorts the results. Direction can be ",[247,871,872],{},"'ASC'"," (default) or ",[247,875,876],{},"'DESC'",[862,878,879,884,885,888],{},[516,880,881],{},[247,882,883],{},".limit(count)",": Limits the query to ",[247,886,887],{},"count"," results.",[862,890,891,896,897,888],{},[516,892,893],{},[247,894,895],{},".offset(count)",": Skips the first ",[247,898,887],{},[267,900,902],{"className":269,"code":901,"language":271,"meta":272,"style":272},"// Get the 10 most recently created users\nconst recentUsers = await db.select(users)\n  .orderBy(users._.columns.createdAt, 'DESC')\n  .limit(10)\n  .all();\n\n// Get the second page of users (10 per page)\nconst pageTwo = await db.select(users)\n  .limit(10)\n  .offset(10) // 10 * (page_number - 1)\n  .all();\n",[247,903,904,909,928,961,975,985,989,994,1013,1025,1042],{"__ignoreMap":272},[276,905,906],{"class":278,"line":279},[276,907,908],{"class":346},"// Get the 10 most recently created users\n",[276,910,911,913,916,918,920,922,924,926],{"class":278,"line":313},[276,912,354],{"class":353},[276,914,915],{"class":290}," recentUsers ",[276,917,360],{"class":286},[276,919,363],{"class":282},[276,921,291],{"class":290},[276,923,265],{"class":286},[276,925,371],{"class":370},[276,927,741],{"class":290},[276,929,930,932,935,937,939,941,943,945,947,950,952,954,957,959],{"class":278,"line":336},[276,931,746],{"class":286},[276,933,934],{"class":370},"orderBy",[276,936,473],{"class":290},[276,938,265],{"class":286},[276,940,478],{"class":290},[276,942,265],{"class":286},[276,944,483],{"class":290},[276,946,265],{"class":286},[276,948,949],{"class":290},"createdAt",[276,951,491],{"class":286},[276,953,300],{"class":286},[276,955,956],{"class":303},"DESC",[276,958,307],{"class":286},[276,960,827],{"class":290},[276,962,963,965,968,970,973],{"class":278,"line":343},[276,964,746],{"class":286},[276,966,967],{"class":370},"limit",[276,969,467],{"class":290},[276,971,972],{"class":494},"10",[276,974,827],{"class":290},[276,976,977,979,981,983],{"class":278,"line":350},[276,978,746],{"class":286},[276,980,379],{"class":370},[276,982,382],{"class":290},[276,984,310],{"class":286},[276,986,987],{"class":278,"line":387},[276,988,340],{"emptyLinePlaceholder":339},[276,990,991],{"class":278,"line":761},[276,992,993],{"class":346},"// Get the second page of users (10 per page)\n",[276,995,996,998,1001,1003,1005,1007,1009,1011],{"class":278,"line":797},[276,997,354],{"class":353},[276,999,1000],{"class":290}," pageTwo ",[276,1002,360],{"class":286},[276,1004,363],{"class":282},[276,1006,291],{"class":290},[276,1008,265],{"class":286},[276,1010,371],{"class":370},[276,1012,741],{"class":290},[276,1014,1015,1017,1019,1021,1023],{"class":278,"line":830},[276,1016,746],{"class":286},[276,1018,967],{"class":370},[276,1020,467],{"class":290},[276,1022,972],{"class":494},[276,1024,827],{"class":290},[276,1026,1027,1029,1032,1034,1036,1039],{"class":278,"line":836},[276,1028,746],{"class":286},[276,1030,1031],{"class":370},"offset",[276,1033,467],{"class":290},[276,1035,972],{"class":494},[276,1037,1038],{"class":290},") ",[276,1040,1041],{"class":346},"// 10 * (page_number - 1)\n",[276,1043,1044,1046,1048,1050],{"class":278,"line":842},[276,1045,746],{"class":286},[276,1047,379],{"class":370},[276,1049,382],{"class":290},[276,1051,310],{"class":286},[1053,1054,1056,1057],"h3",{"id":1055},"easy-pagination-with-paginate","Easy Pagination with ",[247,1058,1059],{},".paginate()",[243,1061,1062,1063,1065],{},"Instead of manually calculating limit/offset, you can use the ",[247,1064,1059],{}," helper:",[267,1067,1069],{"className":269,"code":1068,"language":271,"meta":272,"style":272},"// Get page 1 with 20 items per page\nconst result = await db.select(users)\n  .orderBy(users._.columns.createdAt, 'DESC')\n  .paginate(1, 20);\n\nconsole.log(result);\n/*\n{\n  data: [...],           // The actual user records\n  total: 150,            // Total number of users\n  page: 1,               // Current page\n  pageSize: 20,          // Items per page\n  totalPages: 8,         // Total pages\n  hasNextPage: true,     // Can go to next page\n  hasPrevPage: false     // Can go to previous page\n}\n*/\n",[247,1070,1071,1076,1095,1125,1146,1150,1165,1170,1175,1180,1185,1190,1196,1202,1208,1214,1220],{"__ignoreMap":272},[276,1072,1073],{"class":278,"line":279},[276,1074,1075],{"class":346},"// Get page 1 with 20 items per page\n",[276,1077,1078,1080,1083,1085,1087,1089,1091,1093],{"class":278,"line":313},[276,1079,354],{"class":353},[276,1081,1082],{"class":290}," result ",[276,1084,360],{"class":286},[276,1086,363],{"class":282},[276,1088,291],{"class":290},[276,1090,265],{"class":286},[276,1092,371],{"class":370},[276,1094,741],{"class":290},[276,1096,1097,1099,1101,1103,1105,1107,1109,1111,1113,1115,1117,1119,1121,1123],{"class":278,"line":336},[276,1098,746],{"class":286},[276,1100,934],{"class":370},[276,1102,473],{"class":290},[276,1104,265],{"class":286},[276,1106,478],{"class":290},[276,1108,265],{"class":286},[276,1110,483],{"class":290},[276,1112,265],{"class":286},[276,1114,949],{"class":290},[276,1116,491],{"class":286},[276,1118,300],{"class":286},[276,1120,956],{"class":303},[276,1122,307],{"class":286},[276,1124,827],{"class":290},[276,1126,1127,1129,1132,1134,1137,1139,1142,1144],{"class":278,"line":343},[276,1128,746],{"class":286},[276,1130,1131],{"class":370},"paginate",[276,1133,467],{"class":290},[276,1135,1136],{"class":494},"1",[276,1138,491],{"class":286},[276,1140,1141],{"class":494}," 20",[276,1143,791],{"class":290},[276,1145,310],{"class":286},[276,1147,1148],{"class":278,"line":350},[276,1149,340],{"emptyLinePlaceholder":339},[276,1151,1152,1155,1157,1160,1163],{"class":278,"line":387},[276,1153,1154],{"class":290},"console",[276,1156,265],{"class":286},[276,1158,1159],{"class":370},"log",[276,1161,1162],{"class":290},"(result)",[276,1164,310],{"class":286},[276,1166,1167],{"class":278,"line":761},[276,1168,1169],{"class":346},"/*\n",[276,1171,1172],{"class":278,"line":797},[276,1173,1174],{"class":346},"{\n",[276,1176,1177],{"class":278,"line":830},[276,1178,1179],{"class":346},"  data: [...],           // The actual user records\n",[276,1181,1182],{"class":278,"line":836},[276,1183,1184],{"class":346},"  total: 150,            // Total number of users\n",[276,1186,1187],{"class":278,"line":842},[276,1188,1189],{"class":346},"  page: 1,               // Current page\n",[276,1191,1193],{"class":278,"line":1192},12,[276,1194,1195],{"class":346},"  pageSize: 20,          // Items per page\n",[276,1197,1199],{"class":278,"line":1198},13,[276,1200,1201],{"class":346},"  totalPages: 8,         // Total pages\n",[276,1203,1205],{"class":278,"line":1204},14,[276,1206,1207],{"class":346},"  hasNextPage: true,     // Can go to next page\n",[276,1209,1211],{"class":278,"line":1210},15,[276,1212,1213],{"class":346},"  hasPrevPage: false     // Can go to previous page\n",[276,1215,1217],{"class":278,"line":1216},16,[276,1218,1219],{"class":346},"}\n",[276,1221,1223],{"class":278,"line":1222},17,[276,1224,1225],{"class":346},"*/\n",[252,1227,1229],{"id":1228},"utility-methods","Utility Methods",[1053,1231,1233,1236],{"id":1232},"exists-check-if-rows-exist",[247,1234,1235],{},".exists()"," - Check if Rows Exist",[243,1238,1239],{},"Efficiently check if any rows match your query without fetching data:",[267,1241,1243],{"className":269,"code":1242,"language":271,"meta":272,"style":272},"// Check if a user exists\nconst userExists = await db.select(users)\n  .where(eq(users._.columns.email, 'john@example.com'))\n  .exists();\n// Returns: boolean\n\nif (userExists) {\n  console.log('User already exists!');\n}\n",[247,1244,1245,1250,1269,1305,1316,1321,1325,1335,1358],{"__ignoreMap":272},[276,1246,1247],{"class":278,"line":279},[276,1248,1249],{"class":346},"// Check if a user exists\n",[276,1251,1252,1254,1257,1259,1261,1263,1265,1267],{"class":278,"line":313},[276,1253,354],{"class":353},[276,1255,1256],{"class":290}," userExists ",[276,1258,360],{"class":286},[276,1260,363],{"class":282},[276,1262,291],{"class":290},[276,1264,265],{"class":286},[276,1266,371],{"class":370},[276,1268,741],{"class":290},[276,1270,1271,1273,1275,1277,1279,1281,1283,1285,1287,1289,1291,1293,1295,1297,1300,1302],{"class":278,"line":336},[276,1272,746],{"class":286},[276,1274,464],{"class":370},[276,1276,467],{"class":290},[276,1278,470],{"class":370},[276,1280,473],{"class":290},[276,1282,265],{"class":286},[276,1284,478],{"class":290},[276,1286,265],{"class":286},[276,1288,483],{"class":290},[276,1290,265],{"class":286},[276,1292,815],{"class":290},[276,1294,491],{"class":286},[276,1296,300],{"class":286},[276,1298,1299],{"class":303},"john@example.com",[276,1301,307],{"class":286},[276,1303,1304],{"class":290},"))\n",[276,1306,1307,1309,1312,1314],{"class":278,"line":343},[276,1308,746],{"class":286},[276,1310,1311],{"class":370},"exists",[276,1313,382],{"class":290},[276,1315,310],{"class":286},[276,1317,1318],{"class":278,"line":350},[276,1319,1320],{"class":346},"// Returns: boolean\n",[276,1322,1323],{"class":278,"line":387},[276,1324,340],{"emptyLinePlaceholder":339},[276,1326,1327,1330,1333],{"class":278,"line":761},[276,1328,1329],{"class":282},"if",[276,1331,1332],{"class":290}," (userExists) ",[276,1334,1174],{"class":286},[276,1336,1337,1340,1342,1344,1347,1349,1352,1354,1356],{"class":278,"line":797},[276,1338,1339],{"class":290},"  console",[276,1341,265],{"class":286},[276,1343,1159],{"class":370},[276,1345,467],{"class":1346},"swJcz",[276,1348,307],{"class":286},[276,1350,1351],{"class":303},"User already exists!",[276,1353,307],{"class":286},[276,1355,791],{"class":1346},[276,1357,310],{"class":286},[276,1359,1360],{"class":278,"line":830},[276,1361,1219],{"class":286},[1053,1363,1365,1368],{"id":1364},"count-count-matching-rows",[247,1366,1367],{},".count()"," - Count Matching Rows",[243,1370,1371],{},"Get the number of rows that match your query:",[267,1373,1375],{"className":269,"code":1374,"language":271,"meta":272,"style":272},"// Count all users\nconst totalUsers = await db.select(users).count();\n// Returns: number\n\n// Count active users\nconst activeCount = await db.select(users)\n  .where(eq(users._.columns.isActive, true))\n  .count();\n",[247,1376,1377,1382,1409,1414,1418,1423,1442,1475],{"__ignoreMap":272},[276,1378,1379],{"class":278,"line":279},[276,1380,1381],{"class":346},"// Count all users\n",[276,1383,1384,1386,1389,1391,1393,1395,1397,1399,1401,1403,1405,1407],{"class":278,"line":313},[276,1385,354],{"class":353},[276,1387,1388],{"class":290}," totalUsers ",[276,1390,360],{"class":286},[276,1392,363],{"class":282},[276,1394,291],{"class":290},[276,1396,265],{"class":286},[276,1398,371],{"class":370},[276,1400,374],{"class":290},[276,1402,265],{"class":286},[276,1404,887],{"class":370},[276,1406,382],{"class":290},[276,1408,310],{"class":286},[276,1410,1411],{"class":278,"line":336},[276,1412,1413],{"class":346},"// Returns: number\n",[276,1415,1416],{"class":278,"line":343},[276,1417,340],{"emptyLinePlaceholder":339},[276,1419,1420],{"class":278,"line":350},[276,1421,1422],{"class":346},"// Count active users\n",[276,1424,1425,1427,1430,1432,1434,1436,1438,1440],{"class":278,"line":387},[276,1426,354],{"class":353},[276,1428,1429],{"class":290}," activeCount ",[276,1431,360],{"class":286},[276,1433,363],{"class":282},[276,1435,291],{"class":290},[276,1437,265],{"class":286},[276,1439,371],{"class":370},[276,1441,741],{"class":290},[276,1443,1444,1446,1448,1450,1452,1454,1456,1458,1460,1462,1464,1467,1469,1473],{"class":278,"line":761},[276,1445,746],{"class":286},[276,1447,464],{"class":370},[276,1449,467],{"class":290},[276,1451,470],{"class":370},[276,1453,473],{"class":290},[276,1455,265],{"class":286},[276,1457,478],{"class":290},[276,1459,265],{"class":286},[276,1461,483],{"class":290},[276,1463,265],{"class":286},[276,1465,1466],{"class":290},"isActive",[276,1468,491],{"class":286},[276,1470,1472],{"class":1471},"sfNiH"," true",[276,1474,1304],{"class":290},[276,1476,1477,1479,1481,1483],{"class":278,"line":797},[276,1478,746],{"class":286},[276,1480,887],{"class":370},[276,1482,382],{"class":290},[276,1484,310],{"class":286},[1053,1486,1488,1491],{"id":1487},"pluck-extract-single-column-values",[247,1489,1490],{},".pluck()"," - Extract Single Column Values",[243,1493,1494],{},"Get an array of values from a single column:",[267,1496,1498],{"className":269,"code":1497,"language":271,"meta":272,"style":272},"// Get all user emails\nconst emails = await db.select(users).pluck('email');\n// Returns: string[]\n\n// Get IDs of active users\nconst activeIds = await db.select(users)\n  .where(eq(users._.columns.isActive, true))\n  .pluck('id');\n// Returns: number[] (or string[] depending on column type)\n",[247,1499,1500,1505,1541,1546,1550,1555,1574,1604,1622],{"__ignoreMap":272},[276,1501,1502],{"class":278,"line":279},[276,1503,1504],{"class":346},"// Get all user emails\n",[276,1506,1507,1509,1512,1514,1516,1518,1520,1522,1524,1526,1529,1531,1533,1535,1537,1539],{"class":278,"line":313},[276,1508,354],{"class":353},[276,1510,1511],{"class":290}," emails ",[276,1513,360],{"class":286},[276,1515,363],{"class":282},[276,1517,291],{"class":290},[276,1519,265],{"class":286},[276,1521,371],{"class":370},[276,1523,374],{"class":290},[276,1525,265],{"class":286},[276,1527,1528],{"class":370},"pluck",[276,1530,467],{"class":290},[276,1532,307],{"class":286},[276,1534,815],{"class":303},[276,1536,307],{"class":286},[276,1538,791],{"class":290},[276,1540,310],{"class":286},[276,1542,1543],{"class":278,"line":336},[276,1544,1545],{"class":346},"// Returns: string[]\n",[276,1547,1548],{"class":278,"line":343},[276,1549,340],{"emptyLinePlaceholder":339},[276,1551,1552],{"class":278,"line":350},[276,1553,1554],{"class":346},"// Get IDs of active users\n",[276,1556,1557,1559,1562,1564,1566,1568,1570,1572],{"class":278,"line":387},[276,1558,354],{"class":353},[276,1560,1561],{"class":290}," activeIds ",[276,1563,360],{"class":286},[276,1565,363],{"class":282},[276,1567,291],{"class":290},[276,1569,265],{"class":286},[276,1571,371],{"class":370},[276,1573,741],{"class":290},[276,1575,1576,1578,1580,1582,1584,1586,1588,1590,1592,1594,1596,1598,1600,1602],{"class":278,"line":761},[276,1577,746],{"class":286},[276,1579,464],{"class":370},[276,1581,467],{"class":290},[276,1583,470],{"class":370},[276,1585,473],{"class":290},[276,1587,265],{"class":286},[276,1589,478],{"class":290},[276,1591,265],{"class":286},[276,1593,483],{"class":290},[276,1595,265],{"class":286},[276,1597,1466],{"class":290},[276,1599,491],{"class":286},[276,1601,1472],{"class":1471},[276,1603,1304],{"class":290},[276,1605,1606,1608,1610,1612,1614,1616,1618,1620],{"class":278,"line":797},[276,1607,746],{"class":286},[276,1609,1528],{"class":370},[276,1611,467],{"class":290},[276,1613,307],{"class":286},[276,1615,488],{"class":303},[276,1617,307],{"class":286},[276,1619,791],{"class":290},[276,1621,310],{"class":286},[276,1623,1624],{"class":278,"line":830},[276,1625,1626],{"class":346},"// Returns: number[] (or string[] depending on column type)\n",[252,1628,1630],{"id":1629},"aggregations","Aggregations",[243,1632,1633,1634,1637,1638,265],{},"The query builder also supports grouping and aggregation. Use ",[247,1635,1636],{},"groupBy()"," with aggregate functions from ",[247,1639,1640],{},"@type32/tauri-sqlite-orm/aggregates",[267,1642,1644],{"className":269,"code":1643,"language":271,"meta":272,"style":272},"import { count, avg, sum, min, max } from '@type32/tauri-sqlite-orm';\n\n// These functions are type-safe and can be used with raw SQL\n// For more complex aggregations, see the Advanced Topics section\n",[247,1645,1646,1687,1691,1696],{"__ignoreMap":272},[276,1647,1648,1650,1652,1655,1657,1660,1662,1665,1667,1670,1672,1675,1677,1679,1681,1683,1685],{"class":278,"line":279},[276,1649,283],{"class":282},[276,1651,287],{"class":286},[276,1653,1654],{"class":290}," count",[276,1656,491],{"class":286},[276,1658,1659],{"class":290}," avg",[276,1661,491],{"class":286},[276,1663,1664],{"class":290}," sum",[276,1666,491],{"class":286},[276,1668,1669],{"class":290}," min",[276,1671,491],{"class":286},[276,1673,1674],{"class":290}," max",[276,1676,294],{"class":286},[276,1678,297],{"class":282},[276,1680,300],{"class":286},[276,1682,432],{"class":303},[276,1684,307],{"class":286},[276,1686,310],{"class":286},[276,1688,1689],{"class":278,"line":313},[276,1690,340],{"emptyLinePlaceholder":339},[276,1692,1693],{"class":278,"line":336},[276,1694,1695],{"class":346},"// These functions are type-safe and can be used with raw SQL\n",[276,1697,1698],{"class":278,"line":343},[276,1699,1700],{"class":346},"// For more complex aggregations, see the Advanced Topics section\n",[1702,1703,1706,1707,1710,1711,265],"callout",{"color":1704,"icon":1705},"primary","i-lucide-info","For more complex aggregations that require aliasing, you may need to use joins or raw SQL. See ",[674,1708,201],{"href":1709},"/6.advanced-topics/2.joins"," and ",[674,1712,213],{"href":1713},"/6.advanced-topics/5.raw-sql",[1715,1716,1717],"style",{},"html pre.shiki code .s7zQu, html code.shiki .s7zQu{--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#89DDFF;--shiki-dark-font-style:italic}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html pre.shiki code .sHwdD, html code.shiki .sHwdD{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#546E7A;--shiki-default-font-style:italic;--shiki-dark:#676E95;--shiki-dark-font-style:italic}html pre.shiki code .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}html pre.shiki code .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .sbssI, html code.shiki .sbssI{--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C}html pre.shiki code .swJcz, html code.shiki .swJcz{--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178}html pre.shiki code .sfNiH, html code.shiki .sfNiH{--shiki-light:#FF5370;--shiki-default:#FF9CAC;--shiki-dark:#FF9CAC}",{"title":272,"searchDepth":313,"depth":313,"links":1719},[1720,1721,1722,1723,1725,1729,1737],{"id":254,"depth":313,"text":255},{"id":393,"depth":313,"text":394},{"id":589,"depth":313,"text":590},{"id":663,"depth":313,"text":1724},"Filtering with .where()",{"id":853,"depth":313,"text":854,"children":1726},[1727],{"id":1055,"depth":336,"text":1728},"Easy Pagination with .paginate()",{"id":1228,"depth":313,"text":1229,"children":1730},[1731,1733,1735],{"id":1232,"depth":336,"text":1732},".exists() - Check if Rows Exist",{"id":1364,"depth":336,"text":1734},".count() - Count Matching Rows",{"id":1487,"depth":336,"text":1736},".pluck() - Extract Single Column Values",{"id":1629,"depth":313,"text":1630},"Selecting data using Tauri SQLite ORM.","md",null,{},{"title":168,"description":1738},"RV4zqTufGwkLWYyYQVhe671SFfgz4DuN8RaH93nzxQo",[1745,1747],{"title":159,"path":160,"stem":161,"description":1746,"children":-1},"Migrations are the process of keeping your database schema synchronized with your application's schema definitions in code. This ORM provides a powerful migration system that can handle both simple and complex schema changes.",{"title":172,"path":173,"stem":174,"description":1748,"children":-1},"Inserting data using Tauri SQLite ORM.",1773317302143]