[{"data":1,"prerenderedAt":1493},["ShallowReactive",2],{"navigation_docs":3,"-runtypes-drizzle-orm-views":399},[4,162,346],{"title":5,"icon":6,"path":7,"stem":8,"children":9,"page":24},"RPC","icon-park-outline:lightning","\u002Frpc","01.rpc",[10,25,63,77,102,136],{"title":11,"icon":12,"redirect":7,"path":13,"stem":14,"children":15,"page":24},"Introduction","icon-park-outline:home","\u002Frpc\u002Fintroduction","01.rpc\u002F01.introduction",[16,20],{"title":17,"path":18,"stem":19},"Quick Start","\u002Frpc\u002Fintroduction\u002Fquick-start","01.rpc\u002F01.introduction\u002F02.quick-start",{"title":21,"path":22,"stem":23},"Manual Install","\u002Frpc\u002Fintroduction\u002Fmanual-install","01.rpc\u002F01.introduction\u002F03.manual-install",false,{"title":26,"icon":27,"path":28,"stem":29,"children":30,"page":24},"Server","icon-park-outline:server","\u002Frpc\u002Fserver","01.rpc\u002F02.server",[31,35,39,43,47,51,55,59],{"title":32,"path":33,"stem":34},"Routes","\u002Frpc\u002Fserver\u002Froutes","01.rpc\u002F02.server\u002F01.routes",{"title":36,"path":37,"stem":38},"Middleware","\u002Frpc\u002Fserver\u002Fmiddleware","01.rpc\u002F02.server\u002F02.middleware",{"title":40,"path":41,"stem":42},"Call Context","\u002Frpc\u002Fserver\u002Fcall-context","01.rpc\u002F02.server\u002F03.call-context",{"title":44,"path":45,"stem":46},"Headers","\u002Frpc\u002Fserver\u002Fheaders","01.rpc\u002F02.server\u002F04.headers",{"title":48,"path":49,"stem":50},"Error Handling","\u002Frpc\u002Fserver\u002Ferror-handling","01.rpc\u002F02.server\u002F05.error-handling",{"title":52,"path":53,"stem":54},"Validation","\u002Frpc\u002Fserver\u002Fvalidation","01.rpc\u002F02.server\u002F06.validation",{"title":56,"path":57,"stem":58},"JSON Round Trip","\u002Frpc\u002Fserver\u002Fjson-round-trip","01.rpc\u002F02.server\u002F07.json-round-trip",{"title":60,"path":61,"stem":62},"Drizzle Tables","\u002Frpc\u002Fserver\u002Fdrizzle-tables","01.rpc\u002F02.server\u002F08.drizzle-tables",{"title":64,"icon":65,"path":66,"stem":67,"children":68,"page":24},"Middlewares","icon-park-outline:link-one","\u002Frpc\u002Fmiddlewares","01.rpc\u002F03.middlewares",[69,73],{"title":70,"path":71,"stem":72},"fetchMetadata","\u002Frpc\u002Fmiddlewares\u002Ffetch-metadata","01.rpc\u002F03.middlewares\u002F01.fetch-metadata",{"title":74,"path":75,"stem":76},"syncRoutes","\u002Frpc\u002Fmiddlewares\u002Fsync-routes","01.rpc\u002F03.middlewares\u002F02.sync-routes",{"title":78,"icon":79,"path":80,"stem":81,"children":82,"page":24},"Client","icon-park-outline:computer","\u002Frpc\u002Fclient","01.rpc\u002F04.client",[83,87,91,94,98],{"title":84,"path":85,"stem":86},"Client Overview","\u002Frpc\u002Fclient\u002Fclient-overview","01.rpc\u002F04.client\u002F00.client-overview",{"title":88,"path":89,"stem":90},"Client Middleware","\u002Frpc\u002Fclient\u002Fclient-middleware","01.rpc\u002F04.client\u002F01.client-middleware",{"title":48,"path":92,"stem":93},"\u002Frpc\u002Fclient\u002Ferror-handling","01.rpc\u002F04.client\u002F02.error-handling",{"title":95,"path":96,"stem":97},"Batch Requests","\u002Frpc\u002Fclient\u002Fbatch","01.rpc\u002F04.client\u002F03.batch",{"title":99,"path":100,"stem":101},"Cancellation & Timeouts","\u002Frpc\u002Fclient\u002Fcancellation-timeouts","01.rpc\u002F04.client\u002F04.cancellation-timeouts",{"title":103,"redirect":104,"icon":105,"path":106,"stem":107,"children":108,"page":24},"Platforms","\u002Frpc\u002Fplatforms\u002Fnode-js","icon-park-outline:play","\u002Frpc\u002Fplatforms","01.rpc\u002F06.platforms",[109,112,116,120,124,128,132],{"title":110,"path":104,"stem":111},"Node.js","01.rpc\u002F06.platforms\u002F01.node-js",{"title":113,"path":114,"stem":115},"Bun","\u002Frpc\u002Fplatforms\u002Fbun","01.rpc\u002F06.platforms\u002F02.bun",{"title":117,"path":118,"stem":119},"AWS Lambda","\u002Frpc\u002Fplatforms\u002Faws-lambda","01.rpc\u002F06.platforms\u002F03.aws-lambda",{"title":121,"path":122,"stem":123},"Google Cloud Functions","\u002Frpc\u002Fplatforms\u002Fgoogle-cloud-functions","01.rpc\u002F06.platforms\u002F04.google-cloud-functions",{"title":125,"path":126,"stem":127},"Cloudflare Workers","\u002Frpc\u002Fplatforms\u002Fcloudflare","01.rpc\u002F06.platforms\u002F05.cloudflare",{"title":129,"path":130,"stem":131},"Vercel","\u002Frpc\u002Fplatforms\u002Fvercel","01.rpc\u002F06.platforms\u002F06.vercel",{"title":133,"path":134,"stem":135},"uWebSockets.js","\u002Frpc\u002Fplatforms\u002Fuwebsockets","01.rpc\u002F06.platforms\u002F07.uwebsockets",{"title":137,"icon":138,"path":139,"stem":140,"children":141,"page":24},"Devtools","icon-park-outline:tool","\u002Frpc\u002Fdevtools","01.rpc\u002F07.devtools",[142,146,150,154,158],{"title":143,"path":144,"stem":145},"Linter","\u002Frpc\u002Fdevtools\u002Flinter","01.rpc\u002F07.devtools\u002F01.linter",{"title":147,"path":148,"stem":149},"Vite","\u002Frpc\u002Fdevtools\u002Fvite","01.rpc\u002F07.devtools\u002F02.vite",{"title":151,"path":152,"stem":153},"Next.js","\u002Frpc\u002Fdevtools\u002Fnextjs","01.rpc\u002F07.devtools\u002F03.nextjs",{"title":155,"path":156,"stem":157},"CLI","\u002Frpc\u002Fdevtools\u002Fcli","01.rpc\u002F07.devtools\u002F04.cli",{"title":159,"path":160,"stem":161},"API Types","\u002Frpc\u002Fdevtools\u002Fapi-types","01.rpc\u002F07.devtools\u002F05.api-types",{"title":163,"icon":164,"path":165,"stem":166,"children":167,"page":24},"RunTypes","i-lucide-braces","\u002Fruntypes","02.runtypes",[168,184,224,254,268,290,332],{"title":11,"icon":169,"redirect":165,"path":170,"stem":171,"children":172,"page":24},"i-lucide-rocket","\u002Fruntypes\u002Fintroduction","02.runtypes\u002F01.introduction",[173,177,180],{"title":174,"path":175,"stem":176},"Built on typescript-go","\u002Fruntypes\u002Fintroduction\u002Fbuilt-on-typescript-go","02.runtypes\u002F01.introduction\u002F02.built-on-typescript-go",{"title":17,"path":178,"stem":179},"\u002Fruntypes\u002Fintroduction\u002Fquick-start","02.runtypes\u002F01.introduction\u002F03.quick-start",{"title":181,"path":182,"stem":183},"Configuration","\u002Fruntypes\u002Fintroduction\u002Fconfiguration","02.runtypes\u002F01.introduction\u002F04.configuration",{"title":185,"icon":186,"redirect":187,"path":188,"stem":189,"children":190,"page":24},"Guide","i-lucide-book-open","\u002Fruntypes\u002Fguide\u002Ftype-builders","\u002Fruntypes\u002Fguide","02.runtypes\u002F02.guide",[191,194,198,201,204,208,212,216,220],{"title":192,"path":187,"stem":193},"Types vs Type Builders","02.runtypes\u002F02.guide\u002F01.type-builders",{"title":195,"path":196,"stem":197},"Reflection","\u002Fruntypes\u002Fguide\u002Freflection","02.runtypes\u002F02.guide\u002F02.reflection",{"title":52,"path":199,"stem":200},"\u002Fruntypes\u002Fguide\u002Fvalidation","02.runtypes\u002F02.guide\u002F03.validation",{"title":56,"path":202,"stem":203},"\u002Fruntypes\u002Fguide\u002Fjson-round-trip","02.runtypes\u002F02.guide\u002F04.json-round-trip",{"title":205,"path":206,"stem":207},"Data Mocking","\u002Fruntypes\u002Fguide\u002Fmocking","02.runtypes\u002F02.guide\u002F07.mocking",{"title":209,"path":210,"stem":211},"JSON Schemas","\u002Fruntypes\u002Fguide\u002Fjson-schemas","02.runtypes\u002F02.guide\u002F08.json-schemas",{"title":213,"path":214,"stem":215},"Pure Functions","\u002Fruntypes\u002Fguide\u002Fpure-functions","02.runtypes\u002F02.guide\u002F09.pure-functions",{"title":217,"path":218,"stem":219},"Compiler Markers","\u002Fruntypes\u002Fguide\u002Fcompiler-markers","02.runtypes\u002F02.guide\u002F10.compiler-markers",{"title":221,"path":222,"stem":223},"All Compiled Functions","\u002Fruntypes\u002Fguide\u002Fall-compiled-functions","02.runtypes\u002F02.guide\u002F11.all-compiled-functions",{"title":225,"icon":226,"redirect":227,"path":228,"stem":229,"children":230,"page":24},"Type Formats","i-lucide-shapes","\u002Fruntypes\u002Ftype-formats\u002Foverview","\u002Fruntypes\u002Ftype-formats","02.runtypes\u002F03.type-formats",[231,234,238,242,246,250],{"title":232,"path":227,"stem":233},"Overview","02.runtypes\u002F03.type-formats\u002F01.overview",{"title":235,"path":236,"stem":237},"String Formats","\u002Fruntypes\u002Ftype-formats\u002Fstring","02.runtypes\u002F03.type-formats\u002F02.string",{"title":239,"path":240,"stem":241},"Number Formats","\u002Fruntypes\u002Ftype-formats\u002Fnumber","02.runtypes\u002F03.type-formats\u002F03.number",{"title":243,"path":244,"stem":245},"BigInt Formats","\u002Fruntypes\u002Ftype-formats\u002Fbigint","02.runtypes\u002F03.type-formats\u002F04.bigint",{"title":247,"path":248,"stem":249},"Date and Time Formats","\u002Fruntypes\u002Ftype-formats\u002Fdate-time","02.runtypes\u002F03.type-formats\u002F05.date-time",{"title":251,"path":252,"stem":253},"Collection Formats","\u002Fruntypes\u002Ftype-formats\u002Fcollections","02.runtypes\u002F03.type-formats\u002F06.collections",{"title":255,"icon":256,"redirect":257,"path":258,"stem":259,"children":260,"page":24},"Tooling","i-lucide-wrench","\u002Fruntypes\u002Ftooling\u002Flinting","\u002Fruntypes\u002Ftooling","02.runtypes\u002F04.tooling",[261,264],{"title":262,"path":257,"stem":263},"Linting","02.runtypes\u002F04.tooling\u002F01.linting",{"title":265,"path":266,"stem":267},"Source Conversion","\u002Fruntypes\u002Ftooling\u002Fsource-conversion","02.runtypes\u002F04.tooling\u002F02.source-conversion",{"title":269,"icon":270,"redirect":271,"path":272,"stem":273,"children":274,"page":24},"AI Integration","i-lucide-sparkles","\u002Fruntypes\u002Fai-integration\u002Fworkflow-and-commands","\u002Fruntypes\u002Fai-integration","02.runtypes\u002F05.ai-integration",[275,278,282,286],{"title":276,"path":271,"stem":277},"AI Workflow","02.runtypes\u002F05.ai-integration\u002F01.workflow-and-commands",{"title":279,"path":280,"stem":281},"FriendlyText","\u002Fruntypes\u002Fai-integration\u002Ffriendly-text","02.runtypes\u002F05.ai-integration\u002F02.friendly-text",{"title":283,"path":284,"stem":285},"MockData","\u002Fruntypes\u002Fai-integration\u002Fmock-data","02.runtypes\u002F05.ai-integration\u002F03.mock-data",{"title":287,"path":288,"stem":289},"Translations (i18n)","\u002Fruntypes\u002Fai-integration\u002Fi18n","02.runtypes\u002F05.ai-integration\u002F04.i18n",{"title":291,"icon":292,"redirect":293,"path":294,"stem":295,"children":296,"page":24},"Drizzle ORM","i-lineicons-drizzle","\u002Fruntypes\u002Fdrizzle-orm\u002Fdrizzle-overview","\u002Fruntypes\u002Fdrizzle-orm","02.runtypes\u002F06.drizzle-orm",[297,300,304,308,312,316,320,324,328],{"title":298,"path":293,"stem":299},"Drizzle Overview","02.runtypes\u002F06.drizzle-orm\u002F00.drizzle-overview",{"title":301,"path":302,"stem":303},"Column Formats","\u002Fruntypes\u002Fdrizzle-orm\u002Fcolumn-formats","02.runtypes\u002F06.drizzle-orm\u002F01.column-formats",{"title":305,"path":306,"stem":307},"Views","\u002Fruntypes\u002Fdrizzle-orm\u002Fviews","02.runtypes\u002F06.drizzle-orm\u002F02.views",{"title":309,"path":310,"stem":311},"Indexes and Constraints","\u002Fruntypes\u002Fdrizzle-orm\u002Fconstraints","02.runtypes\u002F06.drizzle-orm\u002F03.constraints",{"title":313,"path":314,"stem":315},"Row Level Security","\u002Fruntypes\u002Fdrizzle-orm\u002Frow-level-security","02.runtypes\u002F06.drizzle-orm\u002F04.row-level-security",{"title":317,"path":318,"stem":319},"Relations","\u002Fruntypes\u002Fdrizzle-orm\u002Frelations","02.runtypes\u002F06.drizzle-orm\u002F05.relations",{"title":321,"path":322,"stem":323},"The Schema File","\u002Fruntypes\u002Fdrizzle-orm\u002Fschema-file","02.runtypes\u002F06.drizzle-orm\u002F06.schema-file",{"title":325,"path":326,"stem":327},"Migrate an Existing Schema","\u002Fruntypes\u002Fdrizzle-orm\u002Fmigrate-an-existing-schema","02.runtypes\u002F06.drizzle-orm\u002F07.migrate-an-existing-schema",{"title":329,"path":330,"stem":331},"Cloudflare D1 and Durable Objects","\u002Fruntypes\u002Fdrizzle-orm\u002Fcloudflare-storage","02.runtypes\u002F06.drizzle-orm\u002F08.cloudflare-storage",{"title":333,"icon":334,"redirect":335,"path":336,"stem":337,"children":338,"page":24},"Diagnostics","i-lucide-triangle-alert","\u002Fruntypes\u002Fdiagnostics\u002Ferror-levels","\u002Fruntypes\u002Fdiagnostics","02.runtypes\u002F08.diagnostics",[339,342],{"title":340,"path":335,"stem":341},"Error Levels","02.runtypes\u002F08.diagnostics\u002F01.error-levels",{"title":343,"path":344,"stem":345},"All Diagnostics","\u002Fruntypes\u002Fdiagnostics\u002Fall-diagnostics","02.runtypes\u002F08.diagnostics\u002F02.all-diagnostics",{"title":347,"icon":348,"path":349,"stem":350,"children":351,"page":24},"Benchmarks","i-lucide-gauge","\u002Fbenchmarks","03.benchmarks",[352,372],{"title":5,"icon":6,"redirect":353,"path":354,"stem":355,"children":356,"page":24},"\u002Fbenchmarks\u002Frpc\u002Fhello-world","\u002Fbenchmarks\u002Frpc","03.benchmarks\u002F02.rpc",[357,360,364,368],{"title":358,"path":353,"stem":359},"Hello World","03.benchmarks\u002F02.rpc\u002F01.hello-world",{"title":361,"path":362,"stem":363},"Light Validation","\u002Fbenchmarks\u002Frpc\u002Flight-validation","03.benchmarks\u002F02.rpc\u002F02.light-validation",{"title":365,"path":366,"stem":367},"Heavy Validation","\u002Fbenchmarks\u002Frpc\u002Fheavy-validation","03.benchmarks\u002F02.rpc\u002F03.heavy-validation",{"title":369,"path":370,"stem":371},"Payload Sizes","\u002Fbenchmarks\u002Frpc\u002Fpayload-sizes","03.benchmarks\u002F02.rpc\u002F04.payload-sizes",{"title":163,"icon":164,"redirect":373,"path":374,"stem":375,"children":376,"page":24},"\u002Fbenchmarks\u002Fruntypes\u002Fis-valid","\u002Fbenchmarks\u002Fruntypes","03.benchmarks\u002F03.runtypes",[377,380,384,388,392,395],{"title":378,"path":373,"stem":379},"Is Valid","03.benchmarks\u002F03.runtypes\u002F01.is-valid",{"title":381,"path":382,"stem":383},"Is Valid Formats","\u002Fbenchmarks\u002Fruntypes\u002Fis-valid-formats","03.benchmarks\u002F03.runtypes\u002F02.is-valid-formats",{"title":385,"path":386,"stem":387},"Get Errors","\u002Fbenchmarks\u002Fruntypes\u002Fget-errors","03.benchmarks\u002F03.runtypes\u002F03.get-errors",{"title":389,"path":390,"stem":391},"Get Errors Formats","\u002Fbenchmarks\u002Fruntypes\u002Fget-errors-formats","03.benchmarks\u002F03.runtypes\u002F04.get-errors-formats",{"title":56,"path":393,"stem":394},"\u002Fbenchmarks\u002Fruntypes\u002Fjson-round-trip","03.benchmarks\u002F03.runtypes\u002F05.json-round-trip",{"title":396,"path":397,"stem":398},"Type Checking","\u002Fbenchmarks\u002Fruntypes\u002Ftype-checking","03.benchmarks\u002F03.runtypes\u002F07.type-checking",{"id":400,"title":305,"body":401,"description":1487,"extension":1488,"links":1489,"meta":1490,"navigation":568,"path":306,"seo":1491,"stem":307,"__hash__":1492},"docs\u002F02.runtypes\u002F06.drizzle-orm\u002F02.views.md",{"type":402,"value":403,"toc":1481},"minimark",[404,413,418,421,1161,1165,1171,1174,1178,1184,1378,1393,1397,1400,1471,1477],[405,406,407,408,412],"p",{},"A view declared with explicit columns works like a table: ",[409,410,411],"code",{},"toDrizzle"," builds the real drizzle view from it, and its row type goes through your routes and your client without drizzle types.",[414,415,417],"h2",{"id":416},"declaring-a-view","Declaring a View",[405,419,420],{},"Give the view its columns, then the query as plain sql. Tables you embed in the query resolve to the real drizzle tables when the view is built.",[422,423,428],"pre",{"className":424,"code":425,"language":426,"meta":427,"style":427},"language-ts shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","import * as DZ from '@mionjs\u002Fdrizzle-orm-pg-core';\nimport type {InferSelectViewModel} from '@mionjs\u002Fdrizzle-orm';\nimport {sql} from '@mionjs\u002Fdrizzle-orm';\nimport {createValidateFn} from '@mionjs\u002Frun-types';\nimport {users} from '.\u002Fdrizzle-proxy-pg-example.ts';\n\nexport const adultUsers = DZ.pgView('adult_users', {\n  id: DZ.uuid('id'),\n  name: DZ.varchar('name', {length: 100, notNull: true}),\n  role: DZ.text('role', {enum: ['admin', 'user'], notNull: true}),\n}).as(sql`select id, name, role from ${users} where age >= 18`);\n\n\u002F\u002F already in the database: drizzle-kit will not create it, but you still get the row type\nexport const legacyUsers = DZ.pgView('legacy_users', {\n  id: DZ.uuid('id'),\n  name: DZ.varchar('name', {length: 100}),\n}).existing();\n\n\u002F\u002F { id: UUID | null; name: String\u003C{maxLength: 100}>; role: 'admin' | 'user' }\nexport type AdultUser = InferSelectViewModel\u003Ctypeof adultUsers>;\n\nexport const validateAdultUser = createValidateFn\u003CAdultUser>();\n\nexport const checks = [\n  validateAdultUser({\n    id: '793aff46-42ac-4372-b7fa-c48ba48ed94f',\n    name: 'ann',\n    role: 'admin',\n  }), \u002F\u002F true\n  validateAdultUser({id: null, name: 'x'.repeat(101), role: 'admin'}), \u002F\u002F false: maxLength 100\n];\n","ts","",[409,429,430,466,495,517,540,563,570,612,644,698,767,805,810,817,848,873,910,927,932,938,964,969,997,1002,1017,1028,1045,1062,1078,1091,1154],{"__ignoreMap":427},[431,432,435,439,443,446,450,453,456,460,463],"span",{"class":433,"line":434},"line",1,[431,436,438],{"class":437},"s7zQu","import",[431,440,442],{"class":441},"sMK4o"," *",[431,444,445],{"class":437}," as",[431,447,449],{"class":448},"sTEyZ"," DZ ",[431,451,452],{"class":437},"from",[431,454,455],{"class":441}," '",[431,457,459],{"class":458},"sfazB","@mionjs\u002Fdrizzle-orm-pg-core",[431,461,462],{"class":441},"'",[431,464,465],{"class":441},";\n",[431,467,469,471,474,477,480,483,486,488,491,493],{"class":433,"line":468},2,[431,470,438],{"class":437},[431,472,473],{"class":437}," type",[431,475,476],{"class":441}," {",[431,478,479],{"class":448},"InferSelectViewModel",[431,481,482],{"class":441},"}",[431,484,485],{"class":437}," from",[431,487,455],{"class":441},[431,489,490],{"class":458},"@mionjs\u002Fdrizzle-orm",[431,492,462],{"class":441},[431,494,465],{"class":441},[431,496,498,500,502,505,507,509,511,513,515],{"class":433,"line":497},3,[431,499,438],{"class":437},[431,501,476],{"class":441},[431,503,504],{"class":448},"sql",[431,506,482],{"class":441},[431,508,485],{"class":437},[431,510,455],{"class":441},[431,512,490],{"class":458},[431,514,462],{"class":441},[431,516,465],{"class":441},[431,518,520,522,524,527,529,531,533,536,538],{"class":433,"line":519},4,[431,521,438],{"class":437},[431,523,476],{"class":441},[431,525,526],{"class":448},"createValidateFn",[431,528,482],{"class":441},[431,530,485],{"class":437},[431,532,455],{"class":441},[431,534,535],{"class":458},"@mionjs\u002Frun-types",[431,537,462],{"class":441},[431,539,465],{"class":441},[431,541,543,545,547,550,552,554,556,559,561],{"class":433,"line":542},5,[431,544,438],{"class":437},[431,546,476],{"class":441},[431,548,549],{"class":448},"users",[431,551,482],{"class":441},[431,553,485],{"class":437},[431,555,455],{"class":441},[431,557,558],{"class":458},".\u002Fdrizzle-proxy-pg-example.ts",[431,560,462],{"class":441},[431,562,465],{"class":441},[431,564,566],{"class":433,"line":565},6,[431,567,569],{"emptyLinePlaceholder":568},true,"\n",[431,571,573,576,580,583,586,589,592,596,599,601,604,606,609],{"class":433,"line":572},7,[431,574,575],{"class":437},"export",[431,577,579],{"class":578},"spNyl"," const",[431,581,582],{"class":448}," adultUsers ",[431,584,585],{"class":441},"=",[431,587,588],{"class":448}," DZ",[431,590,591],{"class":441},".",[431,593,595],{"class":594},"s2Zo4","pgView",[431,597,598],{"class":448},"(",[431,600,462],{"class":441},[431,602,603],{"class":458},"adult_users",[431,605,462],{"class":441},[431,607,608],{"class":441},",",[431,610,611],{"class":441}," {\n",[431,613,615,619,622,624,626,629,631,633,636,638,641],{"class":433,"line":614},8,[431,616,618],{"class":617},"swJcz","  id",[431,620,621],{"class":441},":",[431,623,588],{"class":448},[431,625,591],{"class":441},[431,627,628],{"class":594},"uuid",[431,630,598],{"class":448},[431,632,462],{"class":441},[431,634,635],{"class":458},"id",[431,637,462],{"class":441},[431,639,640],{"class":448},")",[431,642,643],{"class":441},",\n",[431,645,647,650,652,654,656,659,661,663,666,668,670,672,675,677,681,683,686,688,692,694,696],{"class":433,"line":646},9,[431,648,649],{"class":617},"  name",[431,651,621],{"class":441},[431,653,588],{"class":448},[431,655,591],{"class":441},[431,657,658],{"class":594},"varchar",[431,660,598],{"class":448},[431,662,462],{"class":441},[431,664,665],{"class":458},"name",[431,667,462],{"class":441},[431,669,608],{"class":441},[431,671,476],{"class":441},[431,673,674],{"class":617},"length",[431,676,621],{"class":441},[431,678,680],{"class":679},"sbssI"," 100",[431,682,608],{"class":441},[431,684,685],{"class":617}," notNull",[431,687,621],{"class":441},[431,689,691],{"class":690},"sfNiH"," true",[431,693,482],{"class":441},[431,695,640],{"class":448},[431,697,643],{"class":441},[431,699,701,704,706,708,710,713,715,717,720,722,724,726,729,731,734,736,739,741,743,745,748,750,753,755,757,759,761,763,765],{"class":433,"line":700},10,[431,702,703],{"class":617},"  role",[431,705,621],{"class":441},[431,707,588],{"class":448},[431,709,591],{"class":441},[431,711,712],{"class":594},"text",[431,714,598],{"class":448},[431,716,462],{"class":441},[431,718,719],{"class":458},"role",[431,721,462],{"class":441},[431,723,608],{"class":441},[431,725,476],{"class":441},[431,727,728],{"class":617},"enum",[431,730,621],{"class":441},[431,732,733],{"class":448}," [",[431,735,462],{"class":441},[431,737,738],{"class":458},"admin",[431,740,462],{"class":441},[431,742,608],{"class":441},[431,744,455],{"class":441},[431,746,747],{"class":458},"user",[431,749,462],{"class":441},[431,751,752],{"class":448},"]",[431,754,608],{"class":441},[431,756,685],{"class":617},[431,758,621],{"class":441},[431,760,691],{"class":690},[431,762,482],{"class":441},[431,764,640],{"class":448},[431,766,643],{"class":441},[431,768,770,772,774,776,779,781,783,786,789,792,794,796,799,801,803],{"class":433,"line":769},11,[431,771,482],{"class":441},[431,773,640],{"class":448},[431,775,591],{"class":441},[431,777,778],{"class":594},"as",[431,780,598],{"class":448},[431,782,504],{"class":594},[431,784,785],{"class":441},"`",[431,787,788],{"class":458},"select id, name, role from ",[431,790,791],{"class":441},"${",[431,793,549],{"class":448},[431,795,482],{"class":441},[431,797,798],{"class":458}," where age >= 18",[431,800,785],{"class":441},[431,802,640],{"class":448},[431,804,465],{"class":441},[431,806,808],{"class":433,"line":807},12,[431,809,569],{"emptyLinePlaceholder":568},[431,811,813],{"class":433,"line":812},13,[431,814,816],{"class":815},"sHwdD","\u002F\u002F already in the database: drizzle-kit will not create it, but you still get the row type\n",[431,818,820,822,824,827,829,831,833,835,837,839,842,844,846],{"class":433,"line":819},14,[431,821,575],{"class":437},[431,823,579],{"class":578},[431,825,826],{"class":448}," legacyUsers ",[431,828,585],{"class":441},[431,830,588],{"class":448},[431,832,591],{"class":441},[431,834,595],{"class":594},[431,836,598],{"class":448},[431,838,462],{"class":441},[431,840,841],{"class":458},"legacy_users",[431,843,462],{"class":441},[431,845,608],{"class":441},[431,847,611],{"class":441},[431,849,851,853,855,857,859,861,863,865,867,869,871],{"class":433,"line":850},15,[431,852,618],{"class":617},[431,854,621],{"class":441},[431,856,588],{"class":448},[431,858,591],{"class":441},[431,860,628],{"class":594},[431,862,598],{"class":448},[431,864,462],{"class":441},[431,866,635],{"class":458},[431,868,462],{"class":441},[431,870,640],{"class":448},[431,872,643],{"class":441},[431,874,876,878,880,882,884,886,888,890,892,894,896,898,900,902,904,906,908],{"class":433,"line":875},16,[431,877,649],{"class":617},[431,879,621],{"class":441},[431,881,588],{"class":448},[431,883,591],{"class":441},[431,885,658],{"class":594},[431,887,598],{"class":448},[431,889,462],{"class":441},[431,891,665],{"class":458},[431,893,462],{"class":441},[431,895,608],{"class":441},[431,897,476],{"class":441},[431,899,674],{"class":617},[431,901,621],{"class":441},[431,903,680],{"class":679},[431,905,482],{"class":441},[431,907,640],{"class":448},[431,909,643],{"class":441},[431,911,913,915,917,919,922,925],{"class":433,"line":912},17,[431,914,482],{"class":441},[431,916,640],{"class":448},[431,918,591],{"class":441},[431,920,921],{"class":594},"existing",[431,923,924],{"class":448},"()",[431,926,465],{"class":441},[431,928,930],{"class":433,"line":929},18,[431,931,569],{"emptyLinePlaceholder":568},[431,933,935],{"class":433,"line":934},19,[431,936,937],{"class":815},"\u002F\u002F { id: UUID | null; name: String\u003C{maxLength: 100}>; role: 'admin' | 'user' }\n",[431,939,941,943,945,949,952,955,958,961],{"class":433,"line":940},20,[431,942,575],{"class":437},[431,944,473],{"class":578},[431,946,948],{"class":947},"sBMFI"," AdultUser",[431,950,951],{"class":441}," =",[431,953,954],{"class":947}," InferSelectViewModel",[431,956,957],{"class":441},"\u003Ctypeof",[431,959,960],{"class":448}," adultUsers",[431,962,963],{"class":441},">;\n",[431,965,967],{"class":433,"line":966},21,[431,968,569],{"emptyLinePlaceholder":568},[431,970,972,974,976,979,981,984,987,990,993,995],{"class":433,"line":971},22,[431,973,575],{"class":437},[431,975,579],{"class":578},[431,977,978],{"class":448}," validateAdultUser ",[431,980,585],{"class":441},[431,982,983],{"class":594}," createValidateFn",[431,985,986],{"class":441},"\u003C",[431,988,989],{"class":947},"AdultUser",[431,991,992],{"class":441},">",[431,994,924],{"class":448},[431,996,465],{"class":441},[431,998,1000],{"class":433,"line":999},23,[431,1001,569],{"emptyLinePlaceholder":568},[431,1003,1005,1007,1009,1012,1014],{"class":433,"line":1004},24,[431,1006,575],{"class":437},[431,1008,579],{"class":578},[431,1010,1011],{"class":448}," checks ",[431,1013,585],{"class":441},[431,1015,1016],{"class":448}," [\n",[431,1018,1020,1023,1025],{"class":433,"line":1019},25,[431,1021,1022],{"class":594},"  validateAdultUser",[431,1024,598],{"class":448},[431,1026,1027],{"class":441},"{\n",[431,1029,1031,1034,1036,1038,1041,1043],{"class":433,"line":1030},26,[431,1032,1033],{"class":617},"    id",[431,1035,621],{"class":441},[431,1037,455],{"class":441},[431,1039,1040],{"class":458},"793aff46-42ac-4372-b7fa-c48ba48ed94f",[431,1042,462],{"class":441},[431,1044,643],{"class":441},[431,1046,1048,1051,1053,1055,1058,1060],{"class":433,"line":1047},27,[431,1049,1050],{"class":617},"    name",[431,1052,621],{"class":441},[431,1054,455],{"class":441},[431,1056,1057],{"class":458},"ann",[431,1059,462],{"class":441},[431,1061,643],{"class":441},[431,1063,1065,1068,1070,1072,1074,1076],{"class":433,"line":1064},28,[431,1066,1067],{"class":617},"    role",[431,1069,621],{"class":441},[431,1071,455],{"class":441},[431,1073,738],{"class":458},[431,1075,462],{"class":441},[431,1077,643],{"class":441},[431,1079,1081,1084,1086,1088],{"class":433,"line":1080},29,[431,1082,1083],{"class":441},"  }",[431,1085,640],{"class":448},[431,1087,608],{"class":441},[431,1089,1090],{"class":815}," \u002F\u002F true\n",[431,1092,1094,1096,1098,1101,1103,1105,1108,1111,1113,1115,1118,1120,1122,1125,1127,1130,1132,1134,1137,1139,1141,1143,1145,1147,1149,1151],{"class":433,"line":1093},30,[431,1095,1022],{"class":594},[431,1097,598],{"class":448},[431,1099,1100],{"class":441},"{",[431,1102,635],{"class":617},[431,1104,621],{"class":441},[431,1106,1107],{"class":441}," null,",[431,1109,1110],{"class":617}," name",[431,1112,621],{"class":441},[431,1114,455],{"class":441},[431,1116,1117],{"class":458},"x",[431,1119,462],{"class":441},[431,1121,591],{"class":441},[431,1123,1124],{"class":594},"repeat",[431,1126,598],{"class":448},[431,1128,1129],{"class":679},"101",[431,1131,640],{"class":448},[431,1133,608],{"class":441},[431,1135,1136],{"class":617}," role",[431,1138,621],{"class":441},[431,1140,455],{"class":441},[431,1142,738],{"class":458},[431,1144,462],{"class":441},[431,1146,482],{"class":441},[431,1148,640],{"class":448},[431,1150,608],{"class":441},[431,1152,1153],{"class":815}," \u002F\u002F false: maxLength 100\n",[431,1155,1157,1159],{"class":433,"line":1156},31,[431,1158,752],{"class":448},[431,1160,465],{"class":441},[414,1162,1164],{"id":1163},"view-row-types","View Row Types",[405,1166,1167,1168,1170],{},"A view's row type comes from ",[409,1169,479],{},", not the table name. Views are read only, so there is no insert or update model. Drizzle splits the names for the same reason: asking for one is caught while you type.",[405,1172,1173],{},"The columns carry the same format types as a table's, so a validator built from the row type checks the same lengths, ranges and shapes. Rows you query have this type too, so a route can return them as is.",[414,1175,1177],{"id":1176},"materialized-views","Materialized Views",[405,1179,1180,1183],{},[409,1181,1182],{},"pgMaterializedView"," takes the same columns and query, plus the storage options PostgreSQL accepts:",[422,1185,1187],{"className":424,"code":1186,"language":426,"meta":427,"style":427},"export const topTeams = pgMaterializedView('top_teams', {\n  id: serial('id'),\n  code: varchar('code', {length: 10, notNull: true}),\n})\n  .using('btree')\n  .with({fillfactor: 90})\n  .tablespace('custom_tablespace')\n  .withNoData()\n  .as(sql`select id, code from teams`);\n",[409,1188,1189,1216,1237,1280,1287,1306,1329,1347,1357],{"__ignoreMap":427},[431,1190,1191,1193,1195,1198,1200,1203,1205,1207,1210,1212,1214],{"class":433,"line":434},[431,1192,575],{"class":437},[431,1194,579],{"class":578},[431,1196,1197],{"class":448}," topTeams ",[431,1199,585],{"class":441},[431,1201,1202],{"class":594}," pgMaterializedView",[431,1204,598],{"class":448},[431,1206,462],{"class":441},[431,1208,1209],{"class":458},"top_teams",[431,1211,462],{"class":441},[431,1213,608],{"class":441},[431,1215,611],{"class":441},[431,1217,1218,1220,1222,1225,1227,1229,1231,1233,1235],{"class":433,"line":468},[431,1219,618],{"class":617},[431,1221,621],{"class":441},[431,1223,1224],{"class":594}," serial",[431,1226,598],{"class":448},[431,1228,462],{"class":441},[431,1230,635],{"class":458},[431,1232,462],{"class":441},[431,1234,640],{"class":448},[431,1236,643],{"class":441},[431,1238,1239,1242,1244,1247,1249,1251,1253,1255,1257,1259,1261,1263,1266,1268,1270,1272,1274,1276,1278],{"class":433,"line":497},[431,1240,1241],{"class":617},"  code",[431,1243,621],{"class":441},[431,1245,1246],{"class":594}," varchar",[431,1248,598],{"class":448},[431,1250,462],{"class":441},[431,1252,409],{"class":458},[431,1254,462],{"class":441},[431,1256,608],{"class":441},[431,1258,476],{"class":441},[431,1260,674],{"class":617},[431,1262,621],{"class":441},[431,1264,1265],{"class":679}," 10",[431,1267,608],{"class":441},[431,1269,685],{"class":617},[431,1271,621],{"class":441},[431,1273,691],{"class":690},[431,1275,482],{"class":441},[431,1277,640],{"class":448},[431,1279,643],{"class":441},[431,1281,1282,1284],{"class":433,"line":519},[431,1283,482],{"class":441},[431,1285,1286],{"class":448},")\n",[431,1288,1289,1292,1295,1297,1299,1302,1304],{"class":433,"line":542},[431,1290,1291],{"class":441},"  .",[431,1293,1294],{"class":594},"using",[431,1296,598],{"class":448},[431,1298,462],{"class":441},[431,1300,1301],{"class":458},"btree",[431,1303,462],{"class":441},[431,1305,1286],{"class":448},[431,1307,1308,1310,1313,1315,1317,1320,1322,1325,1327],{"class":433,"line":565},[431,1309,1291],{"class":441},[431,1311,1312],{"class":594},"with",[431,1314,598],{"class":448},[431,1316,1100],{"class":441},[431,1318,1319],{"class":617},"fillfactor",[431,1321,621],{"class":441},[431,1323,1324],{"class":679}," 90",[431,1326,482],{"class":441},[431,1328,1286],{"class":448},[431,1330,1331,1333,1336,1338,1340,1343,1345],{"class":433,"line":572},[431,1332,1291],{"class":441},[431,1334,1335],{"class":594},"tablespace",[431,1337,598],{"class":448},[431,1339,462],{"class":441},[431,1341,1342],{"class":458},"custom_tablespace",[431,1344,462],{"class":441},[431,1346,1286],{"class":448},[431,1348,1349,1351,1354],{"class":433,"line":614},[431,1350,1291],{"class":441},[431,1352,1353],{"class":594},"withNoData",[431,1355,1356],{"class":448},"()\n",[431,1358,1359,1361,1363,1365,1367,1369,1372,1374,1376],{"class":433,"line":646},[431,1360,1291],{"class":441},[431,1362,778],{"class":594},[431,1364,598],{"class":448},[431,1366,504],{"class":594},[431,1368,785],{"class":441},[431,1370,1371],{"class":458},"select id, code from teams",[431,1373,785],{"class":441},[431,1375,640],{"class":448},[431,1377,465],{"class":441},[405,1379,1380,1381,1384,1385,1388,1389,1392],{},"MySQL views take ",[409,1382,1383],{},"algorithm",", ",[409,1386,1387],{},"sqlSecurity"," and ",[409,1390,1391],{},"withCheckOption"," instead. SQLite views take no options.",[414,1394,1396],{"id":1395},"views-built-from-a-query","Views Built From a Query",[405,1398,1399],{},"Drizzle can also declare a view whose columns come from a query builder:",[422,1401,1403],{"className":424,"code":1402,"language":426,"meta":427,"style":427},"\u002F\u002F this form stays on drizzle\nexport const userView = pgView('user_view').as((qb) => qb.select().from(user));\n",[409,1404,1405,1410],{"__ignoreMap":427},[431,1406,1407],{"class":433,"line":434},[431,1408,1409],{"class":815},"\u002F\u002F this form stays on drizzle\n",[431,1411,1412,1414,1416,1419,1421,1424,1426,1428,1431,1433,1435,1437,1439,1441,1443,1447,1449,1452,1455,1457,1460,1462,1464,1466,1469],{"class":433,"line":468},[431,1413,575],{"class":437},[431,1415,579],{"class":578},[431,1417,1418],{"class":448}," userView ",[431,1420,585],{"class":441},[431,1422,1423],{"class":594}," pgView",[431,1425,598],{"class":448},[431,1427,462],{"class":441},[431,1429,1430],{"class":458},"user_view",[431,1432,462],{"class":441},[431,1434,640],{"class":448},[431,1436,591],{"class":441},[431,1438,778],{"class":594},[431,1440,598],{"class":448},[431,1442,598],{"class":441},[431,1444,1446],{"class":1445},"sHdIc","qb",[431,1448,640],{"class":441},[431,1450,1451],{"class":578}," =>",[431,1453,1454],{"class":448}," qb",[431,1456,591],{"class":441},[431,1458,1459],{"class":594},"select",[431,1461,924],{"class":448},[431,1463,591],{"class":441},[431,1465,452],{"class":594},[431,1467,1468],{"class":448},"(user))",[431,1470,465],{"class":441},[405,1472,1473,1474,1476],{},"Its columns come from drizzle's own query typing, which these packages keep out of your app. Declare those views with drizzle, over your ",[409,1475,411],{}," tables, in the file that runs your queries. Their rows keep the formats of the table columns they select. For a view's row type in your app, declare the columns yourself.",[1478,1479,1480],"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 .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 pre.shiki code .swJcz, html code.shiki .swJcz{--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178}html pre.shiki code .sbssI, html code.shiki .sbssI{--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C}html pre.shiki code .sfNiH, html code.shiki .sfNiH{--shiki-light:#FF5370;--shiki-default:#FF9CAC;--shiki-dark:#FF9CAC}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 .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}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 .sHdIc, html code.shiki .sHdIc{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#EEFFFF;--shiki-default-font-style:italic;--shiki-dark:#BABED8;--shiki-dark-font-style:italic}",{"title":427,"searchDepth":468,"depth":468,"links":1482},[1483,1484,1485,1486],{"id":416,"depth":468,"text":417},{"id":1163,"depth":468,"text":1164},{"id":1176,"depth":468,"text":1177},{"id":1395,"depth":468,"text":1396},"Declare a view with its columns and get a row type your whole app can use.","md",null,{},{"title":305,"description":1487},"lz3glwtL0ft9DWpVpG642ksdevzxspA8365yqIE9zQ8",1793324366207]