[{"data":1,"prerenderedAt":2321},["ShallowReactive",2],{"navigation_docs_en":3,"-en-dbx-bunx":441,"-en-dbx-bunx-surround":2316},[4,45,60,81,112,129,146,173,197,213,242,279,356,372,384,403,429],{"title":5,"icon":6,"path":7,"stem":8,"children":9,"page":44},"Getting Started","i-lucide-rocket","\u002Fen\u002Fgetting-started","en\u002F1.getting-started",[10,15,20,24,29,34,39],{"title":11,"path":12,"stem":13,"icon":14},"Introduction","\u002Fen\u002Fgetting-started\u002Fintroduction","en\u002F1.getting-started\u002F1.introduction","i-lucide-house",{"title":16,"path":17,"stem":18,"icon":19},"Coming from Laravel","\u002Fen\u002Fgetting-started\u002Fcoming-from-laravel","en\u002F1.getting-started\u002F2.coming-from-laravel","i-lucide-arrow-right-left",{"title":21,"path":22,"stem":23,"icon":19},"Coming from Symfony","\u002Fen\u002Fgetting-started\u002Fcoming-from-symfony","en\u002F1.getting-started\u002F3.coming-from-symfony",{"title":25,"path":26,"stem":27,"icon":28},"Installation","\u002Fen\u002Fgetting-started\u002Finstallation","en\u002F1.getting-started\u002F4.installation","i-lucide-download",{"title":30,"path":31,"stem":32,"icon":33},"Your first module","\u002Fen\u002Fgetting-started\u002Ffirst-module","en\u002F1.getting-started\u002F5.first-module","i-lucide-package-plus",{"title":35,"path":36,"stem":37,"icon":38},"Project structure","\u002Fen\u002Fgetting-started\u002Fproject-structure","en\u002F1.getting-started\u002F6.project-structure","i-lucide-folder-tree",{"title":40,"path":41,"stem":42,"icon":43},"The shop sample application","\u002Fen\u002Fgetting-started\u002Fsample-app","en\u002F1.getting-started\u002F7.sample-app","i-lucide-shopping-cart",false,{"title":46,"icon":47,"path":48,"stem":49,"children":50,"page":44},"queue","i-lucide-layers","\u002Fen\u002Fqueue","en\u002F10.queue",[51,56],{"title":52,"path":53,"stem":54,"icon":55},"Overview","\u002Fen\u002Fqueue\u002Foverview","en\u002F10.queue\u002F1.overview","i-lucide-list-ordered",{"title":57,"path":58,"stem":59,"icon":47},"Tasks","\u002Fen\u002Fqueue\u002Ftasks","en\u002F10.queue\u002F2.tasks",{"title":61,"icon":62,"path":63,"stem":64,"children":65,"page":44},"events","i-lucide-workflow","\u002Fen\u002Fevents","en\u002F11.events",[66,71,76],{"title":67,"path":68,"stem":69,"icon":70},"Events","\u002Fen\u002Fevents\u002Foverview","en\u002F11.events\u002F1.overview","i-lucide-radio",{"title":72,"path":73,"stem":74,"icon":75},"Outbox","\u002Fen\u002Fevents\u002Foutbox","en\u002F11.events\u002F2.outbox","i-lucide-inbox",{"title":77,"path":78,"stem":79,"icon":80},"Scheduling","\u002Fen\u002Fevents\u002Fscheduler","en\u002F11.events\u002F3.scheduler","i-lucide-calendar-clock",{"title":82,"icon":83,"path":84,"stem":85,"children":86,"page":44},"auth","i-lucide-shield-check","\u002Fen\u002Fauth","en\u002F12.auth",[87,92,97,102,107],{"title":88,"path":89,"stem":90,"icon":91},"Authentication","\u002Fen\u002Fauth\u002Foverview","en\u002F12.auth\u002F1.overview","i-lucide-key-round",{"title":93,"path":94,"stem":95,"icon":96},"RBAC","\u002Fen\u002Fauth\u002Frbac","en\u002F12.auth\u002F2.rbac","i-lucide-users",{"title":98,"path":99,"stem":100,"icon":101},"Policies","\u002Fen\u002Fauth\u002Fpolicy","en\u002F12.auth\u002F3.policy","i-lucide-gavel",{"title":103,"path":104,"stem":105,"icon":106},"Using auth standalone","\u002Fen\u002Fauth\u002Fstandalone","en\u002F12.auth\u002F4.standalone","i-lucide-plug",{"title":108,"path":109,"stem":110,"icon":111},"Social login with goth, standalone","\u002Fen\u002Fauth\u002Fsocial-standalone","en\u002F12.auth\u002F5.social-standalone","i-lucide-log-in",{"title":113,"icon":114,"path":115,"stem":116,"children":117,"page":44},"mail","i-lucide-mail","\u002Fen\u002Fmail","en\u002F13.mail",[118,121,125],{"title":52,"path":119,"stem":120,"icon":114},"\u002Fen\u002Fmail\u002Foverview","en\u002F13.mail\u002F1.overview",{"title":122,"path":123,"stem":124,"icon":114},"SMTP","\u002Fen\u002Fmail\u002Fsmtp","en\u002F13.mail\u002F2.smtp",{"title":126,"path":127,"stem":128,"icon":114},"MJML","\u002Fen\u002Fmail\u002Fmjml","en\u002F13.mail\u002F3.mjml",{"title":130,"icon":131,"path":132,"stem":133,"children":134,"page":44},"notify","i-lucide-bell","\u002Fen\u002Fnotify","en\u002F14.notify",[135,138,142],{"title":52,"path":136,"stem":137,"icon":131},"\u002Fen\u002Fnotify\u002Foverview","en\u002F14.notify\u002F1.overview",{"title":139,"path":140,"stem":141,"icon":131},"Database channel","\u002Fen\u002Fnotify\u002Fdatabase","en\u002F14.notify\u002F2.database",{"title":143,"path":144,"stem":145,"icon":131},"Broadcast channel","\u002Fen\u002Fnotify\u002Fbroadcast","en\u002F14.notify\u002F3.broadcast",{"title":147,"icon":148,"path":149,"stem":150,"children":151,"page":44},"storage","i-lucide-hard-drive","\u002Fen\u002Fstorage","en\u002F15.storage",[152,155,159,163,168],{"title":52,"path":153,"stem":154,"icon":148},"\u002Fen\u002Fstorage\u002Foverview","en\u002F15.storage\u002F1.overview",{"title":156,"path":157,"stem":158},"Disk API","\u002Fen\u002Fstorage\u002Fdisk-api","en\u002F15.storage\u002F2.disk-api",{"title":160,"path":161,"stem":162,"icon":148},"Memory and local disk","\u002Fen\u002Fstorage\u002Flocal","en\u002F15.storage\u002F3.local",{"title":164,"path":165,"stem":166,"icon":167},"S3","\u002Fen\u002Fstorage\u002Fs3","en\u002F15.storage\u002F4.s3","i-lucide-cloud",{"title":169,"path":170,"stem":171,"icon":172},"Testing","\u002Fen\u002Fstorage\u002Ftesting","en\u002F15.storage\u002F5.testing","i-lucide-flask-conical",{"title":174,"icon":175,"path":176,"stem":177,"children":178,"page":44},"telemetry","i-lucide-activity","\u002Fen\u002Ftelemetry","en\u002F16.telemetry",[179,182,187,192],{"title":52,"path":180,"stem":181,"icon":175},"\u002Fen\u002Ftelemetry\u002Foverview","en\u002F16.telemetry\u002F1.overview",{"title":183,"path":184,"stem":185,"icon":186},"Logging","\u002Fen\u002Ftelemetry\u002Flogging","en\u002F16.telemetry\u002F2.logging","i-lucide-scroll-text",{"title":188,"path":189,"stem":190,"icon":191},"OpenTelemetry","\u002Fen\u002Ftelemetry\u002Fopentelemetry","en\u002F16.telemetry\u002F3.opentelemetry","i-lucide-radar",{"title":193,"path":194,"stem":195,"icon":196},"Sentry","\u002Fen\u002Ftelemetry\u002Fsentry","en\u002F16.telemetry\u002F4.sentry","i-lucide-bug",{"title":198,"icon":199,"path":200,"stem":201,"children":202,"page":44},"Reference","i-lucide-book-open","\u002Fen\u002Freference","en\u002F17.reference",[203,208],{"title":204,"path":205,"stem":206,"icon":207},"Configuration","\u002Fen\u002Freference\u002Fconfiguration","en\u002F17.reference\u002F1.configuration","i-lucide-settings",{"title":209,"path":210,"stem":211,"icon":212},"External dependencies","\u002Fen\u002Freference\u002Fdependencies","en\u002F17.reference\u002F2.dependencies","i-lucide-package",{"title":214,"icon":215,"path":216,"stem":217,"children":218,"page":44},"Concepts","i-lucide-lightbulb","\u002Fen\u002Fconcepts","en\u002F2.concepts",[219,223,228,232,237],{"title":220,"path":221,"stem":222,"icon":47},"Architecture","\u002Fen\u002Fconcepts\u002Farchitecture","en\u002F2.concepts\u002F1.architecture",{"title":224,"path":225,"stem":226,"icon":227},"Error model","\u002Fen\u002Fconcepts\u002Ferror-model","en\u002F2.concepts\u002F2.error-model","i-lucide-shield-alert",{"title":204,"path":229,"stem":230,"icon":231},"\u002Fen\u002Fconcepts\u002Fconfiguration","en\u002F2.concepts\u002F3.configuration","i-lucide-settings-2",{"title":233,"path":234,"stem":235,"icon":236},"Codegen pipeline","\u002Fen\u002Fconcepts\u002Fcodegen-pipeline","en\u002F2.concepts\u002F4.codegen-pipeline","i-lucide-file-json",{"title":238,"path":239,"stem":240,"icon":241},"Design patterns","\u002Fen\u002Fconcepts\u002Fdesign-patterns","en\u002F2.concepts\u002F5.design-patterns","i-lucide-puzzle",{"title":243,"icon":244,"path":245,"stem":246,"children":247,"page":44},"Kit","i-lucide-box","\u002Fen\u002Fkit","en\u002F3.kit",[248,251,256,261,266,270,275],{"title":52,"path":249,"stem":250,"icon":244},"\u002Fen\u002Fkit\u002Foverview","en\u002F3.kit\u002F1.overview",{"title":252,"path":253,"stem":254,"icon":255},"Application lifecycle","\u002Fen\u002Fkit\u002Fapp","en\u002F3.kit\u002F2.app","i-lucide-power",{"title":257,"path":258,"stem":259,"icon":260},"Server","\u002Fen\u002Fkit\u002Fserver","en\u002F3.kit\u002F3.server","i-lucide-server",{"title":262,"path":263,"stem":264,"icon":265},"Worker","\u002Fen\u002Fkit\u002Fworker","en\u002F3.kit\u002F4.worker","i-lucide-cog",{"title":267,"path":268,"stem":269,"icon":70},"Realtime","\u002Fen\u002Fkit\u002Frealtime","en\u002F3.kit\u002F5.realtime",{"title":271,"path":272,"stem":273,"icon":274},"Migrations","\u002Fen\u002Fkit\u002Fmigrations","en\u002F3.kit\u002F6.migrations","i-lucide-file-stack",{"title":276,"path":277,"stem":278,"icon":111},"Social login","\u002Fen\u002Fkit\u002Fsocial-login","en\u002F3.kit\u002F7.social-login",{"title":280,"icon":281,"path":282,"stem":283,"children":284,"page":44},"CLI Reference","i-lucide-terminal","\u002Fen\u002Fcli","en\u002F4.cli",[285,288,293,298,303,308,313,318,323,328,333,337,342,347,351],{"title":52,"path":286,"stem":287,"icon":281},"\u002Fen\u002Fcli\u002Foverview","en\u002F4.cli\u002F1.overview",{"title":289,"path":290,"stem":291,"icon":292},"add db","\u002Fen\u002Fcli\u002Fadd-db","en\u002F4.cli\u002F10.add-db","i-lucide-database-zap",{"title":294,"path":295,"stem":296,"icon":297},"add compose \u002F add docker","\u002Fen\u002Fcli\u002Fadd-compose","en\u002F4.cli\u002F11.add-compose","i-lucide-container",{"title":299,"path":300,"stem":301,"icon":302},"add mail","\u002Fen\u002Fcli\u002Fadd-mail","en\u002F4.cli\u002F12.add-mail","i-lucide-mail-plus",{"title":304,"path":305,"stem":306,"icon":307},"add notification","\u002Fen\u002Fcli\u002Fadd-notification","en\u002F4.cli\u002F13.add-notification","i-lucide-bell-plus",{"title":309,"path":310,"stem":311,"icon":312},"add realtime","\u002Fen\u002Fcli\u002Fadd-realtime","en\u002F4.cli\u002F14.add-realtime","i-lucide-radio-tower",{"title":314,"path":315,"stem":316,"icon":317},"add seeder","\u002Fen\u002Fcli\u002Fadd-seeder","en\u002F4.cli\u002F15.add-seeder","i-lucide-sprout",{"title":319,"path":320,"stem":321,"icon":322},"new project","\u002Fen\u002Fcli\u002Fnew-project","en\u002F4.cli\u002F2.new-project","i-lucide-folder-plus",{"title":324,"path":325,"stem":326,"icon":327},"new module","\u002Fen\u002Fcli\u002Fnew-module","en\u002F4.cli\u002F3.new-module","i-lucide-blocks",{"title":329,"path":330,"stem":331,"icon":332},"add surface","\u002Fen\u002Fcli\u002Fadd-surface","en\u002F4.cli\u002F4.add-surface","i-lucide-layers-2",{"title":334,"path":335,"stem":336,"icon":244},"add core","\u002Fen\u002Fcli\u002Fadd-core","en\u002F4.cli\u002F5.add-core",{"title":338,"path":339,"stem":340,"icon":341},"add handler","\u002Fen\u002Fcli\u002Fadd-handler","en\u002F4.cli\u002F6.add-handler","i-lucide-webhook",{"title":343,"path":344,"stem":345,"icon":346},"new migration","\u002Fen\u002Fcli\u002Fnew-migration","en\u002F4.cli\u002F7.new-migration","i-lucide-file-plus",{"title":348,"path":349,"stem":350,"icon":265},"worker generators","\u002Fen\u002Fcli\u002Fworker-generators","en\u002F4.cli\u002F8.worker-generators",{"title":352,"path":353,"stem":354,"icon":355},"upgrade templates","\u002Fen\u002Fcli\u002Fupgrade-templates","en\u002F4.cli\u002F9.upgrade-templates","i-lucide-refresh-cw",{"title":357,"icon":227,"path":358,"stem":359,"children":360,"page":44},"errs","\u002Fen\u002Ferrs","en\u002F5.errs",[361,364,368],{"title":52,"path":362,"stem":363,"icon":227},"\u002Fen\u002Ferrs\u002Foverview","en\u002F5.errs\u002F1.overview",{"title":365,"path":366,"stem":367},"API","\u002Fen\u002Ferrs\u002Fapi","en\u002F5.errs\u002F2.api",{"title":369,"path":370,"stem":371,"icon":227},"Integration","\u002Fen\u002Ferrs\u002Fintegration","en\u002F5.errs\u002F3.integration",{"title":373,"icon":231,"path":374,"stem":375,"children":376,"page":44},"envconf","\u002Fen\u002Fenvconf","en\u002F6.envconf",[377,380],{"title":52,"path":378,"stem":379,"icon":231},"\u002Fen\u002Fenvconf\u002Foverview","en\u002F6.envconf\u002F1.overview",{"title":381,"path":382,"stem":383},"Recipes","\u002Fen\u002Fenvconf\u002Frecipes","en\u002F6.envconf\u002F2.recipes",{"title":385,"icon":386,"path":387,"stem":388,"children":389,"page":44},"httperr","i-lucide-globe","\u002Fen\u002Fhttperr","en\u002F7.httperr",[390,393,398],{"title":52,"path":391,"stem":392,"icon":386},"\u002Fen\u002Fhttperr\u002Foverview","en\u002F7.httperr\u002F1.overview",{"title":394,"path":395,"stem":396,"icon":397},"Error responses","\u002Fen\u002Fhttperr\u002Ferror-responses","en\u002F7.httperr\u002F2.error-responses","i-lucide-octagon-alert",{"title":399,"path":400,"stem":401,"icon":402},"Validation","\u002Fen\u002Fhttperr\u002Fvalidation","en\u002F7.httperr\u002F3.validation","i-lucide-badge-check",{"title":404,"icon":405,"path":406,"stem":407,"children":408,"page":44},"dbx","i-lucide-database","\u002Fen\u002Fdbx","en\u002F8.dbx",[409,412,416,420,425],{"title":52,"path":410,"stem":411,"icon":405},"\u002Fen\u002Fdbx\u002Foverview","en\u002F8.dbx\u002F1.overview",{"title":413,"path":414,"stem":415,"icon":106},"pgx","\u002Fen\u002Fdbx\u002Fpg","en\u002F8.dbx\u002F2.pg",{"title":417,"path":418,"stem":419,"icon":47},"bun","\u002Fen\u002Fdbx\u002Fbunx","en\u002F8.dbx\u002F3.bunx",{"title":421,"path":422,"stem":423,"icon":424},"Transactions","\u002Fen\u002Fdbx\u002Ftransactions","en\u002F8.dbx\u002F4.transactions","i-lucide-git-merge",{"title":426,"path":427,"stem":428,"icon":317},"Seeders","\u002Fen\u002Fdbx\u002Fseed","en\u002F8.dbx\u002F5.seed",{"title":430,"icon":55,"path":431,"stem":432,"children":433,"page":44},"paginate","\u002Fen\u002Fpaginate","en\u002F9.paginate",[434,437],{"title":52,"path":435,"stem":436,"icon":55},"\u002Fen\u002Fpaginate\u002Foverview","en\u002F9.paginate\u002F1.overview",{"title":438,"path":439,"stem":440,"icon":19},"Cursor pagination","\u002Fen\u002Fpaginate\u002Fcursor","en\u002F9.paginate\u002F2.cursor",{"id":442,"title":417,"body":443,"description":2309,"extension":2310,"links":2311,"meta":2312,"navigation":2313,"path":418,"seo":2314,"stem":419,"__hash__":2315},"docs_en\u002Fen\u002F8.dbx\u002F3.bunx.md",{"type":444,"value":445,"toc":2298},"minimark",[446,484,513,518,525,547,566,570,594,740,783,787,822,839,843,871,878,1253,1262,1376,1380,1405,1666,1691,1698,1702,1722,1759,1763,1793,1797,1807,2263,2267,2294],[447,448,449,453,454,460,461,465,466,471,472,475,476,483],"p",{},[450,451,452],"code",{},"dbx\u002Fbunx"," is the optional ",[455,456,417],"a",{"href":457,"rel":458},"https:\u002F\u002Fbun.uptrace.dev",[459],"nofollow"," adapter for ",[455,462,463],{"href":410},[450,464,404],{},"'s transaction model. The default ",[455,467,468],{"href":414},[450,469,470],{},"dbx\u002Fpg"," carries a native ",[450,473,474],{},"pgx.Tx"," in the context and works with hand-written SQL; a project that wants bun for query building wires this package instead. Bun ",[477,478,479,480],"strong",{},"only enters the binary when something imports ",[450,481,482],{},"bunx",". A project that doesn't need it stays bun-free entirely.",[485,486,491],"pre",{"className":487,"code":488,"language":489,"meta":490,"style":490},"language-go shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","import \"github.com\u002Fgp-system\u002Fdbx\u002Fbunx\"\n","go","",[450,492,493],{"__ignoreMap":490},[494,495,498,502,506,510],"span",{"class":496,"line":497},"line",1,[494,499,501],{"class":500},"s7zQu","import",[494,503,505],{"class":504},"sMK4o"," \"",[494,507,509],{"class":508},"sBMFI","github.com\u002Fgp-system\u002Fdbx\u002Fbunx",[494,511,512],{"class":504},"\"\n",[514,515,517],"h2",{"id":516},"what-bun-is-and-what-it-is-not","What bun is, and what it is not",[447,519,520,521,524],{},"Let's be honest about the positioning: bun is a ",[477,522,523],{},"query builder with struct mapping"," (an \"ORM-lite\"), not Eloquent. What you get:",[526,527,528,540],"ul",{},[529,530,531,532,535,536,539],"li",{},"struct-based models (",[450,533,534],{},"bun:\"...\""," tags), builder-style query writing (",[450,537,538],{},"NewSelect().Model(...).Where(...)","),",[529,541,542,543,546],{},"relation loading (",[450,544,545],{},"Relation(...)","), bulk insert\u002Fupdate, typed scanning.",[447,548,549,550,553,554,557,558,561,562,565],{},"What you do ",[477,551,552],{},"not"," get from Eloquent: no ActiveRecord (",[450,555,556],{},"$product->save()","), no model events (",[450,559,560],{},"creating","\u002F",[450,563,564],{},"saved","), no lazy loading, no accessors\u002Fmutators, no global scopes. A model is a plain struct; a query is an explicit builder call. This can feel spartan at first compared to a full ActiveRecord ORM. In exchange, every query lives where you wrote it, and exactly what you see is what runs.",[514,567,569],{"id":568},"wiring","Wiring",[447,571,572,573,576,577,579,580,582,583,582,586,589,590,593],{},"You pick it with the ",[450,574,575],{},"--db bun"," flag at project generation (see ",[455,578,319],{"href":320},"); the manifest records it, and every later generator (",[450,581,324],{},", ",[450,584,585],{},"add event",[450,587,588],{},"add worker",") emits bun-flavoured code. The generated ",[450,591,592],{},"main.go"," wires it like this:",[485,595,597],{"className":487,"code":596,"language":489,"meta":490,"style":490},"pool := pg.MustNewPool(ctx, cfg.DB)   \u002F\u002F pool construction is shared with the pgx stack\nbunDB := bunx.Open(pool)\n\ndeps := shop.Dependencies{\n    DB:         bunDB,                     \u002F\u002F *bun.DB, the repositories hold this\n    Transactor: bunx.NewTransactor(bunDB), \u002F\u002F instead of pg.NewTransactor(pool)\n}\n",[450,598,599,642,666,673,692,709,734],{"__ignoreMap":490},[494,600,601,605,608,611,614,618,621,624,627,630,632,635,638],{"class":496,"line":497},[494,602,604],{"class":603},"sTEyZ","pool ",[494,606,607],{"class":504},":=",[494,609,610],{"class":603}," pg",[494,612,613],{"class":504},".",[494,615,617],{"class":616},"s2Zo4","MustNewPool",[494,619,620],{"class":504},"(",[494,622,623],{"class":603},"ctx",[494,625,626],{"class":504},",",[494,628,629],{"class":603}," cfg",[494,631,613],{"class":504},[494,633,634],{"class":603},"DB",[494,636,637],{"class":504},")",[494,639,641],{"class":640},"sHwdD","   \u002F\u002F pool construction is shared with the pgx stack\n",[494,643,645,648,650,653,655,658,660,663],{"class":496,"line":644},2,[494,646,647],{"class":603},"bunDB ",[494,649,607],{"class":504},[494,651,652],{"class":603}," bunx",[494,654,613],{"class":504},[494,656,657],{"class":616},"Open",[494,659,620],{"class":504},[494,661,662],{"class":603},"pool",[494,664,665],{"class":504},")\n",[494,667,669],{"class":496,"line":668},3,[494,670,672],{"emptyLinePlaceholder":671},true,"\n",[494,674,676,679,681,684,686,689],{"class":496,"line":675},4,[494,677,678],{"class":603},"deps ",[494,680,607],{"class":504},[494,682,683],{"class":508}," shop",[494,685,613],{"class":504},[494,687,688],{"class":508},"Dependencies",[494,690,691],{"class":504},"{\n",[494,693,695,698,701,704,706],{"class":496,"line":694},5,[494,696,697],{"class":603},"    DB",[494,699,700],{"class":504},":",[494,702,703],{"class":603},"         bunDB",[494,705,626],{"class":504},[494,707,708],{"class":640},"                     \u002F\u002F *bun.DB, the repositories hold this\n",[494,710,712,715,717,719,721,724,726,729,731],{"class":496,"line":711},6,[494,713,714],{"class":603},"    Transactor",[494,716,700],{"class":504},[494,718,652],{"class":603},[494,720,613],{"class":504},[494,722,723],{"class":616},"NewTransactor",[494,725,620],{"class":504},[494,727,728],{"class":603},"bunDB",[494,730,539],{"class":504},[494,732,733],{"class":640}," \u002F\u002F instead of pg.NewTransactor(pool)\n",[494,735,737],{"class":496,"line":736},7,[494,738,739],{"class":504},"}\n",[447,741,742,745,746,749,750,753,754,757,758,764,765,767,768,771,772,775,776,778,779,782],{},[450,743,744],{},"bunx.Open"," builds a ",[450,747,748],{},"*bun.DB"," over the given ",[450,751,752],{},"pgxpool.Pool"," (with ",[450,755,756],{},"pgdialect","), so the ",[455,759,761],{"href":760},"\u002Fen\u002Fdbx\u002Foverview#config",[450,762,763],{},"dbx.Config"," and the pool configuration are reused; closing the pool closes the underlying handles. ",[450,766,657],{}," also installs the ",[450,769,770],{},"bunotel"," query hook: queries running through the bun query builder emit OTel spans (statement + timing) just like the pgx path, and show up in the ",[455,773,774],{"href":189},"trace waterfall"," and in ",[455,777,193],{"href":194},". Raw SQL running through ",[450,780,781],{},"bunx.Conn"," bypasses this hook (see below).",[514,784,786],{"id":785},"the-transactor-contract-is-identical","The Transactor contract is identical",[447,788,789,792,793,799,800,802,803,806,807,810,811,813,814,817,818,821],{},[450,790,791],{},"bunx.NewTransactor"," returns the same ",[455,794,796],{"href":795},"\u002Fen\u002Fdbx\u002Foverview#transactor",[450,797,798],{},"dbx.Transactor"," interface as ",[450,801,470],{},": commit on ",[450,804,805],{},"nil",", rollback on error or panic, a nested call joins the outer transaction (flat nesting, the outermost call commits). The only difference is the carried type: a ",[450,808,809],{},"bun.Tx"," travels in the context instead of a ",[450,812,474],{},", with the ",[450,815,816],{},"bunx.ContextWithTx"," \u002F ",[450,819,820],{},"bunx.TxFromContext"," pair.",[447,823,824,825,828,829,832,833,835,836,838],{},"Which means your ",[477,826,827],{},"service layer does not change"," when you switch implementations: the ",[450,830,831],{},"PlaceOrder"," service on the ",[455,834,421],{"href":422}," page is identical to the letter on pgx and on bun, only the ",[450,837,592],{}," wiring and the repositories' internals differ.",[514,840,842],{"id":841},"repositories","Repositories",[447,844,845,846,582,849,852,853,856,857,859,860,863,864,866,867,870],{},"Bun's query builder methods (",[450,847,848],{},"NewSelect",[450,850,851],{},"NewInsert",", …) take no context, so a repository resolves the query surface from the context at the top of each method. ",[450,854,855],{},"bunx.From"," returns the ",[450,858,809],{}," carried by the context (when ",[450,861,862],{},"WithinTransaction"," opened one), otherwise the root ",[450,865,748],{},", both are ",[450,868,869],{},"bun.IDB",", so the caller uses the result uniformly.",[447,872,873,874,877],{},"The ",[455,875,876],{"href":41},"shop","'s product repository with bun:",[485,879,881],{"className":487,"code":880,"language":489,"meta":490,"style":490},"package repository\n\ntype Product struct {\n    bun.BaseModel `bun:\"table:products\"`\n\n    ID         int64     `bun:\"id,pk,autoincrement\"`\n    Name       string    `bun:\"name,notnull\"`\n    PriceCents int64     `bun:\"price_cents,notnull\"`\n    Stock      int       `bun:\"stock,notnull\"`\n    CreatedAt  time.Time `bun:\"created_at,notnull\"`\n}\n\ntype ProductRepository struct {\n    db *bun.DB\n}\n\nfunc (r *ProductRepository) ListProducts(ctx context.Context, limit int) ([]Product, error) {\n    var products []Product\n    err := bunx.From(ctx, r.db).NewSelect().Model(&products).\n        OrderExpr(\"created_at DESC, id DESC\").\n        Limit(limit).\n        Scan(ctx)\n    return products, err\n}\n",[450,882,883,891,895,909,929,933,950,966,981,998,1019,1024,1029,1041,1057,1062,1067,1127,1142,1191,1209,1222,1234,1248],{"__ignoreMap":490},[494,884,885,888],{"class":496,"line":497},[494,886,887],{"class":504},"package",[494,889,890],{"class":508}," repository\n",[494,892,893],{"class":496,"line":644},[494,894,672],{"emptyLinePlaceholder":671},[494,896,897,900,903,906],{"class":496,"line":668},[494,898,899],{"class":504},"type",[494,901,902],{"class":508}," Product",[494,904,905],{"class":504}," struct",[494,907,908],{"class":504}," {\n",[494,910,911,914,916,919,922,926],{"class":496,"line":675},[494,912,913],{"class":508},"    bun",[494,915,613],{"class":504},[494,917,918],{"class":508},"BaseModel",[494,920,921],{"class":504}," `",[494,923,925],{"class":924},"sfazB","bun:\"table:products\"",[494,927,928],{"class":504},"`\n",[494,930,931],{"class":496,"line":694},[494,932,672],{"emptyLinePlaceholder":671},[494,934,935,938,942,945,948],{"class":496,"line":711},[494,936,937],{"class":603},"    ID         ",[494,939,941],{"class":940},"spNyl","int64",[494,943,944],{"class":504},"     `",[494,946,947],{"class":924},"bun:\"id,pk,autoincrement\"",[494,949,928],{"class":504},[494,951,952,955,958,961,964],{"class":496,"line":736},[494,953,954],{"class":603},"    Name       ",[494,956,957],{"class":940},"string",[494,959,960],{"class":504},"    `",[494,962,963],{"class":924},"bun:\"name,notnull\"",[494,965,928],{"class":504},[494,967,969,972,974,976,979],{"class":496,"line":968},8,[494,970,971],{"class":603},"    PriceCents ",[494,973,941],{"class":940},[494,975,944],{"class":504},[494,977,978],{"class":924},"bun:\"price_cents,notnull\"",[494,980,928],{"class":504},[494,982,984,987,990,993,996],{"class":496,"line":983},9,[494,985,986],{"class":603},"    Stock      ",[494,988,989],{"class":940},"int",[494,991,992],{"class":504},"       `",[494,994,995],{"class":924},"bun:\"stock,notnull\"",[494,997,928],{"class":504},[494,999,1001,1004,1007,1009,1012,1014,1017],{"class":496,"line":1000},10,[494,1002,1003],{"class":603},"    CreatedAt  ",[494,1005,1006],{"class":508},"time",[494,1008,613],{"class":504},[494,1010,1011],{"class":508},"Time",[494,1013,921],{"class":504},[494,1015,1016],{"class":924},"bun:\"created_at,notnull\"",[494,1018,928],{"class":504},[494,1020,1022],{"class":496,"line":1021},11,[494,1023,739],{"class":504},[494,1025,1027],{"class":496,"line":1026},12,[494,1028,672],{"emptyLinePlaceholder":671},[494,1030,1032,1034,1037,1039],{"class":496,"line":1031},13,[494,1033,899],{"class":504},[494,1035,1036],{"class":508}," ProductRepository",[494,1038,905],{"class":504},[494,1040,908],{"class":504},[494,1042,1044,1047,1050,1052,1054],{"class":496,"line":1043},14,[494,1045,1046],{"class":603},"    db ",[494,1048,1049],{"class":504},"*",[494,1051,417],{"class":508},[494,1053,613],{"class":504},[494,1055,1056],{"class":508},"DB\n",[494,1058,1060],{"class":496,"line":1059},15,[494,1061,739],{"class":504},[494,1063,1065],{"class":496,"line":1064},16,[494,1066,672],{"emptyLinePlaceholder":671},[494,1068,1070,1073,1076,1080,1082,1085,1087,1090,1092,1094,1097,1099,1102,1104,1107,1110,1112,1115,1118,1120,1123,1125],{"class":496,"line":1069},17,[494,1071,1072],{"class":504},"func",[494,1074,1075],{"class":504}," (",[494,1077,1079],{"class":1078},"sHdIc","r ",[494,1081,1049],{"class":504},[494,1083,1084],{"class":508},"ProductRepository",[494,1086,637],{"class":504},[494,1088,1089],{"class":616}," ListProducts",[494,1091,620],{"class":504},[494,1093,623],{"class":1078},[494,1095,1096],{"class":508}," context",[494,1098,613],{"class":504},[494,1100,1101],{"class":508},"Context",[494,1103,626],{"class":504},[494,1105,1106],{"class":1078}," limit",[494,1108,1109],{"class":940}," int",[494,1111,637],{"class":504},[494,1113,1114],{"class":504}," ([]",[494,1116,1117],{"class":508},"Product",[494,1119,626],{"class":504},[494,1121,1122],{"class":940}," error",[494,1124,637],{"class":504},[494,1126,908],{"class":504},[494,1128,1130,1133,1136,1139],{"class":496,"line":1129},18,[494,1131,1132],{"class":504},"    var",[494,1134,1135],{"class":603}," products ",[494,1137,1138],{"class":504},"[]",[494,1140,1141],{"class":508},"Product\n",[494,1143,1145,1148,1150,1152,1154,1157,1159,1161,1163,1166,1168,1171,1174,1176,1179,1182,1185,1188],{"class":496,"line":1144},19,[494,1146,1147],{"class":603},"    err ",[494,1149,607],{"class":504},[494,1151,652],{"class":603},[494,1153,613],{"class":504},[494,1155,1156],{"class":616},"From",[494,1158,620],{"class":504},[494,1160,623],{"class":603},[494,1162,626],{"class":504},[494,1164,1165],{"class":603}," r",[494,1167,613],{"class":504},[494,1169,1170],{"class":603},"db",[494,1172,1173],{"class":504},").",[494,1175,848],{"class":616},[494,1177,1178],{"class":504},"().",[494,1180,1181],{"class":616},"Model",[494,1183,1184],{"class":504},"(&",[494,1186,1187],{"class":603},"products",[494,1189,1190],{"class":504},").\n",[494,1192,1194,1197,1199,1202,1205,1207],{"class":496,"line":1193},20,[494,1195,1196],{"class":616},"        OrderExpr",[494,1198,620],{"class":504},[494,1200,1201],{"class":504},"\"",[494,1203,1204],{"class":924},"created_at DESC, id DESC",[494,1206,1201],{"class":504},[494,1208,1190],{"class":504},[494,1210,1212,1215,1217,1220],{"class":496,"line":1211},21,[494,1213,1214],{"class":616},"        Limit",[494,1216,620],{"class":504},[494,1218,1219],{"class":603},"limit",[494,1221,1190],{"class":504},[494,1223,1225,1228,1230,1232],{"class":496,"line":1224},22,[494,1226,1227],{"class":616},"        Scan",[494,1229,620],{"class":504},[494,1231,623],{"class":603},[494,1233,665],{"class":504},[494,1235,1237,1240,1243,1245],{"class":496,"line":1236},23,[494,1238,1239],{"class":500},"    return",[494,1241,1242],{"class":603}," products",[494,1244,626],{"class":504},[494,1246,1247],{"class":603}," err\n",[494,1249,1251],{"class":496,"line":1250},24,[494,1252,739],{"class":504},[447,1254,1255,1256,1258,1259,1261],{},"The order insert, called from the ",[450,1257,831],{}," transaction, runs on the ",[450,1260,809],{}," automatically:",[485,1263,1265],{"className":487,"code":1264,"language":489,"meta":490,"style":490},"func (r *OrderRepository) Insert(ctx context.Context, o *Order) error {\n    _, err := bunx.From(ctx, r.db).NewInsert().Model(o).Exec(ctx)\n    return err\n}\n",[450,1266,1267,1312,1366,1372],{"__ignoreMap":490},[494,1268,1269,1271,1273,1275,1277,1280,1282,1285,1287,1289,1291,1293,1295,1297,1300,1303,1306,1308,1310],{"class":496,"line":497},[494,1270,1072],{"class":504},[494,1272,1075],{"class":504},[494,1274,1079],{"class":1078},[494,1276,1049],{"class":504},[494,1278,1279],{"class":508},"OrderRepository",[494,1281,637],{"class":504},[494,1283,1284],{"class":616}," Insert",[494,1286,620],{"class":504},[494,1288,623],{"class":1078},[494,1290,1096],{"class":508},[494,1292,613],{"class":504},[494,1294,1101],{"class":508},[494,1296,626],{"class":504},[494,1298,1299],{"class":1078}," o",[494,1301,1302],{"class":504}," *",[494,1304,1305],{"class":508},"Order",[494,1307,637],{"class":504},[494,1309,1122],{"class":940},[494,1311,908],{"class":504},[494,1313,1314,1317,1319,1322,1324,1326,1328,1330,1332,1334,1336,1338,1340,1342,1344,1346,1348,1350,1352,1355,1357,1360,1362,1364],{"class":496,"line":644},[494,1315,1316],{"class":603},"    _",[494,1318,626],{"class":504},[494,1320,1321],{"class":603}," err ",[494,1323,607],{"class":504},[494,1325,652],{"class":603},[494,1327,613],{"class":504},[494,1329,1156],{"class":616},[494,1331,620],{"class":504},[494,1333,623],{"class":603},[494,1335,626],{"class":504},[494,1337,1165],{"class":603},[494,1339,613],{"class":504},[494,1341,1170],{"class":603},[494,1343,1173],{"class":504},[494,1345,851],{"class":616},[494,1347,1178],{"class":504},[494,1349,1181],{"class":616},[494,1351,620],{"class":504},[494,1353,1354],{"class":603},"o",[494,1356,1173],{"class":504},[494,1358,1359],{"class":616},"Exec",[494,1361,620],{"class":504},[494,1363,623],{"class":603},[494,1365,665],{"class":504},[494,1367,1368,1370],{"class":496,"line":668},[494,1369,1239],{"class":500},[494,1371,1247],{"class":603},[494,1373,1374],{"class":496,"line":675},[494,1375,739],{"class":504},[514,1377,1379],{"id":1378},"raw-sql-and-sqlc-the-conn-resolver","Raw SQL and sqlc: the Conn resolver",[447,1381,1382,1383,1385,1386,1389,1390,1393,1394,1397,1398,1400,1401,1404],{},"Because a ",[450,1384,809],{}," embeds a ",[450,1387,1388],{},"*sql.Tx",", raw SQL and sqlc (in ",[450,1391,1392],{},"database\u002Fsql"," mode) can join ",[477,1395,1396],{},"the same transaction"," through ",[450,1399,781],{},". The shop's stock decrement: an atomic ",[450,1402,1403],{},"UPDATE"," that would be awkward to express with the builder:",[485,1406,1408],{"className":487,"code":1407,"language":489,"meta":490,"style":490},"func (r *ProductRepository) DecrementStock(ctx context.Context, productID int64, qty int) error {\n    res, err := bunx.Conn(ctx, r.db).ExecContext(ctx,\n        `UPDATE products SET stock = stock - $2 WHERE id = $1 AND stock >= $2`,\n        productID, qty)\n    if err != nil {\n        return err\n    }\n    if n, _ := res.RowsAffected(); n == 0 {\n        return errs.New(\"insufficient stock\",\n            errs.Code(\"insufficient_stock\"), errs.Public(\"The product is out of stock.\"))\n    }\n    return nil\n}\n",[450,1409,1410,1458,1500,1513,1524,1539,1546,1551,1588,1611,1651,1655,1662],{"__ignoreMap":490},[494,1411,1412,1414,1416,1418,1420,1422,1424,1427,1429,1431,1433,1435,1437,1439,1442,1445,1447,1450,1452,1454,1456],{"class":496,"line":497},[494,1413,1072],{"class":504},[494,1415,1075],{"class":504},[494,1417,1079],{"class":1078},[494,1419,1049],{"class":504},[494,1421,1084],{"class":508},[494,1423,637],{"class":504},[494,1425,1426],{"class":616}," DecrementStock",[494,1428,620],{"class":504},[494,1430,623],{"class":1078},[494,1432,1096],{"class":508},[494,1434,613],{"class":504},[494,1436,1101],{"class":508},[494,1438,626],{"class":504},[494,1440,1441],{"class":1078}," productID",[494,1443,1444],{"class":940}," int64",[494,1446,626],{"class":504},[494,1448,1449],{"class":1078}," qty",[494,1451,1109],{"class":940},[494,1453,637],{"class":504},[494,1455,1122],{"class":940},[494,1457,908],{"class":504},[494,1459,1460,1463,1465,1467,1469,1471,1473,1476,1478,1480,1482,1484,1486,1488,1490,1493,1495,1497],{"class":496,"line":644},[494,1461,1462],{"class":603},"    res",[494,1464,626],{"class":504},[494,1466,1321],{"class":603},[494,1468,607],{"class":504},[494,1470,652],{"class":603},[494,1472,613],{"class":504},[494,1474,1475],{"class":616},"Conn",[494,1477,620],{"class":504},[494,1479,623],{"class":603},[494,1481,626],{"class":504},[494,1483,1165],{"class":603},[494,1485,613],{"class":504},[494,1487,1170],{"class":603},[494,1489,1173],{"class":504},[494,1491,1492],{"class":616},"ExecContext",[494,1494,620],{"class":504},[494,1496,623],{"class":603},[494,1498,1499],{"class":504},",\n",[494,1501,1502,1505,1508,1511],{"class":496,"line":668},[494,1503,1504],{"class":504},"        `",[494,1506,1507],{"class":924},"UPDATE products SET stock = stock - $2 WHERE id = $1 AND stock >= $2",[494,1509,1510],{"class":504},"`",[494,1512,1499],{"class":504},[494,1514,1515,1518,1520,1522],{"class":496,"line":675},[494,1516,1517],{"class":603},"        productID",[494,1519,626],{"class":504},[494,1521,1449],{"class":603},[494,1523,665],{"class":504},[494,1525,1526,1529,1531,1534,1537],{"class":496,"line":694},[494,1527,1528],{"class":500},"    if",[494,1530,1321],{"class":603},[494,1532,1533],{"class":504},"!=",[494,1535,1536],{"class":504}," nil",[494,1538,908],{"class":504},[494,1540,1541,1544],{"class":496,"line":711},[494,1542,1543],{"class":500},"        return",[494,1545,1247],{"class":603},[494,1547,1548],{"class":496,"line":736},[494,1549,1550],{"class":504},"    }\n",[494,1552,1553,1555,1558,1560,1563,1565,1568,1570,1573,1576,1579,1582,1586],{"class":496,"line":968},[494,1554,1528],{"class":500},[494,1556,1557],{"class":603}," n",[494,1559,626],{"class":504},[494,1561,1562],{"class":603}," _ ",[494,1564,607],{"class":504},[494,1566,1567],{"class":603}," res",[494,1569,613],{"class":504},[494,1571,1572],{"class":616},"RowsAffected",[494,1574,1575],{"class":504},"();",[494,1577,1578],{"class":603}," n ",[494,1580,1581],{"class":504},"==",[494,1583,1585],{"class":1584},"sbssI"," 0",[494,1587,908],{"class":504},[494,1589,1590,1592,1595,1597,1600,1602,1604,1607,1609],{"class":496,"line":983},[494,1591,1543],{"class":500},[494,1593,1594],{"class":603}," errs",[494,1596,613],{"class":504},[494,1598,1599],{"class":616},"New",[494,1601,620],{"class":504},[494,1603,1201],{"class":504},[494,1605,1606],{"class":924},"insufficient stock",[494,1608,1201],{"class":504},[494,1610,1499],{"class":504},[494,1612,1613,1616,1618,1621,1623,1625,1628,1630,1632,1634,1636,1639,1641,1643,1646,1648],{"class":496,"line":1000},[494,1614,1615],{"class":603},"            errs",[494,1617,613],{"class":504},[494,1619,1620],{"class":616},"Code",[494,1622,620],{"class":504},[494,1624,1201],{"class":504},[494,1626,1627],{"class":924},"insufficient_stock",[494,1629,1201],{"class":504},[494,1631,539],{"class":504},[494,1633,1594],{"class":603},[494,1635,613],{"class":504},[494,1637,1638],{"class":616},"Public",[494,1640,620],{"class":504},[494,1642,1201],{"class":504},[494,1644,1645],{"class":924},"The product is out of stock.",[494,1647,1201],{"class":504},[494,1649,1650],{"class":504},"))\n",[494,1652,1653],{"class":496,"line":1021},[494,1654,1550],{"class":504},[494,1656,1657,1659],{"class":496,"line":1026},[494,1658,1239],{"class":500},[494,1660,1661],{"class":504}," nil\n",[494,1663,1664],{"class":496,"line":1031},[494,1665,739],{"class":504},[447,1667,1668,1670,1671,1674,1675,817,1677,1680,1681,1684,1685,1688,1689,613],{},[450,1669,781],{}," deliberately returns the ",[477,1672,1673],{},"raw"," ",[450,1676,1388],{},[450,1678,1679],{},"*sql.DB",", not the bun wrappers. The bun wrapper reformats every query through its own placeholder syntax (",[450,1682,1683],{},"?","), which would break native ",[450,1686,1687],{},"$N"," placeholders, so sqlc-generated postgres SQL runs unchanged too. The trade-off is that queries running this way skip bun's query hooks (otel\u002Flogging); code that wants those uses the bun builder via ",[450,1690,1156],{},[1692,1693,1694,1695,613],"note",{},"The \"one transaction, two query styles\" guarantee (bun builder + raw SQL, shared commit\u002Frollback) is pinned down by dbx's own integration tests against a real PostgreSQL: ",[450,1696,1697],{},"go test -tags=integration .\u002Fdbx\u002Fbunx\u002F",[514,1699,1701],{"id":1700},"outbox-under-bun","Outbox under bun",[447,1703,873,1704,1707,1708,1711,1712,1715,1716,1718,1719,1721],{},[455,1705,1706],{"href":73},"outbox"," store has a bun adapter too, mirroring the same split: bun projects wire ",[450,1709,1710],{},"NewStore(bunDB)"," from ",[450,1713,1714],{},"github.com\u002Fgp-system\u002Fevents\u002Foutbox\u002Fbunx",", so the outbox insert joins the bun transaction opened by ",[450,1717,862],{},". The generator wires this automatically in ",[450,1720,575],{}," projects:",[485,1723,1725],{"className":487,"code":1724,"language":489,"meta":490,"style":490},"Dispatcher: outbox.NewDispatcher(outboxbunx.NewStore(bunDB)),\n",[450,1726,1727],{"__ignoreMap":490},[494,1728,1729,1732,1734,1737,1739,1742,1744,1747,1749,1752,1754,1756],{"class":496,"line":497},[494,1730,1731],{"class":603},"Dispatcher",[494,1733,700],{"class":504},[494,1735,1736],{"class":603}," outbox",[494,1738,613],{"class":504},[494,1740,1741],{"class":616},"NewDispatcher",[494,1743,620],{"class":504},[494,1745,1746],{"class":603},"outboxbunx",[494,1748,613],{"class":504},[494,1750,1751],{"class":616},"NewStore",[494,1753,620],{"class":504},[494,1755,728],{"class":603},[494,1757,1758],{"class":504},")),\n",[514,1760,1762],{"id":1761},"constraint","Constraint",[447,1764,1765,1766,1768,1769,1771,1772,1774,1775,1778,1779,1781,1782,1785,1786,1788,1789,1792],{},"Within a single project, ",[450,1767,482],{}," and the pgx-native executor (",[450,1770,470],{},"'s ",[450,1773,634],{},") ",[477,1776,1777],{},"cannot share one transaction",": the two abstractions check out connections through different paths and carry the transaction under different context keys. In a bun project, raw SQL goes through ",[450,1780,781],{},", never through ",[450,1783,1784],{},"pg.NewDB(pool)",". ",[455,1787,271],{"href":272}," are unaffected: the same ",[450,1790,1791],{},"cmd\u002Fmigrate"," binary runs under both stacks.",[514,1794,1796],{"id":1795},"standalone-example","Standalone example",[447,1798,1799,1801,1802,582,1804,1806],{},[450,1800,452],{}," needs nothing from the kit either: ",[450,1803,657],{},[450,1805,1156],{}," and a transactor are enough on their own.",[485,1808,1810],{"className":487,"code":1809,"filename":592,"language":489,"meta":490,"style":490},"package main\n\nimport (\n    \"context\"\n    \"log\"\n\n    \"github.com\u002Fgp-system\u002Fdbx\"\n    \"github.com\u002Fgp-system\u002Fdbx\u002Fbunx\"\n    \"github.com\u002Fgp-system\u002Fdbx\u002Fpg\"\n)\n\nfunc main() {\n    ctx := context.Background()\n    pool := pg.MustNewPool(ctx, dbx.Config{\n        Host: \"localhost\", Port: 5432,\n        User: \"shop\", Password: \"secret\", Database: \"shop\",\n    })\n    defer pool.Close()\n\n    bunDB := bunx.Open(pool)\n    tx := bunx.NewTransactor(bunDB)\n\n    err := tx.WithinTransaction(ctx, func(ctx context.Context) error {\n        _, err := bunx.From(ctx, bunDB).NewUpdate().\n            Table(\"products\").Set(\"stock = stock - 1\").Where(\"id = ?\", \"prod_42\").Exec(ctx)\n        return err\n    })\n    if err != nil {\n        log.Fatal(err)\n    }\n}\n",[450,1811,1812,1819,1823,1830,1840,1849,1853,1862,1870,1879,1883,1887,1899,1916,1945,1971,2013,2018,2033,2037,2056,2075,2079,2115,2149,2210,2217,2222,2235,2253,2258],{"__ignoreMap":490},[494,1813,1814,1816],{"class":496,"line":497},[494,1815,887],{"class":504},[494,1817,1818],{"class":508}," main\n",[494,1820,1821],{"class":496,"line":644},[494,1822,672],{"emptyLinePlaceholder":671},[494,1824,1825,1827],{"class":496,"line":668},[494,1826,501],{"class":500},[494,1828,1829],{"class":504}," (\n",[494,1831,1832,1835,1838],{"class":496,"line":675},[494,1833,1834],{"class":504},"    \"",[494,1836,1837],{"class":508},"context",[494,1839,512],{"class":504},[494,1841,1842,1844,1847],{"class":496,"line":694},[494,1843,1834],{"class":504},[494,1845,1846],{"class":508},"log",[494,1848,512],{"class":504},[494,1850,1851],{"class":496,"line":711},[494,1852,672],{"emptyLinePlaceholder":671},[494,1854,1855,1857,1860],{"class":496,"line":736},[494,1856,1834],{"class":504},[494,1858,1859],{"class":508},"github.com\u002Fgp-system\u002Fdbx",[494,1861,512],{"class":504},[494,1863,1864,1866,1868],{"class":496,"line":968},[494,1865,1834],{"class":504},[494,1867,509],{"class":508},[494,1869,512],{"class":504},[494,1871,1872,1874,1877],{"class":496,"line":983},[494,1873,1834],{"class":504},[494,1875,1876],{"class":508},"github.com\u002Fgp-system\u002Fdbx\u002Fpg",[494,1878,512],{"class":504},[494,1880,1881],{"class":496,"line":1000},[494,1882,665],{"class":504},[494,1884,1885],{"class":496,"line":1021},[494,1886,672],{"emptyLinePlaceholder":671},[494,1888,1889,1891,1894,1897],{"class":496,"line":1026},[494,1890,1072],{"class":504},[494,1892,1893],{"class":616}," main",[494,1895,1896],{"class":504},"()",[494,1898,908],{"class":504},[494,1900,1901,1904,1906,1908,1910,1913],{"class":496,"line":1031},[494,1902,1903],{"class":603},"    ctx ",[494,1905,607],{"class":504},[494,1907,1096],{"class":603},[494,1909,613],{"class":504},[494,1911,1912],{"class":616},"Background",[494,1914,1915],{"class":504},"()\n",[494,1917,1918,1921,1923,1925,1927,1929,1931,1933,1935,1938,1940,1943],{"class":496,"line":1043},[494,1919,1920],{"class":603},"    pool ",[494,1922,607],{"class":504},[494,1924,610],{"class":603},[494,1926,613],{"class":504},[494,1928,617],{"class":616},[494,1930,620],{"class":504},[494,1932,623],{"class":603},[494,1934,626],{"class":504},[494,1936,1937],{"class":508}," dbx",[494,1939,613],{"class":504},[494,1941,1942],{"class":508},"Config",[494,1944,691],{"class":504},[494,1946,1947,1950,1952,1954,1957,1959,1961,1964,1966,1969],{"class":496,"line":1059},[494,1948,1949],{"class":603},"        Host",[494,1951,700],{"class":504},[494,1953,505],{"class":504},[494,1955,1956],{"class":924},"localhost",[494,1958,1201],{"class":504},[494,1960,626],{"class":504},[494,1962,1963],{"class":603}," Port",[494,1965,700],{"class":504},[494,1967,1968],{"class":1584}," 5432",[494,1970,1499],{"class":504},[494,1972,1973,1976,1978,1980,1982,1984,1986,1989,1991,1993,1996,1998,2000,2003,2005,2007,2009,2011],{"class":496,"line":1064},[494,1974,1975],{"class":603},"        User",[494,1977,700],{"class":504},[494,1979,505],{"class":504},[494,1981,876],{"class":924},[494,1983,1201],{"class":504},[494,1985,626],{"class":504},[494,1987,1988],{"class":603}," Password",[494,1990,700],{"class":504},[494,1992,505],{"class":504},[494,1994,1995],{"class":924},"secret",[494,1997,1201],{"class":504},[494,1999,626],{"class":504},[494,2001,2002],{"class":603}," Database",[494,2004,700],{"class":504},[494,2006,505],{"class":504},[494,2008,876],{"class":924},[494,2010,1201],{"class":504},[494,2012,1499],{"class":504},[494,2014,2015],{"class":496,"line":1069},[494,2016,2017],{"class":504},"    })\n",[494,2019,2020,2023,2026,2028,2031],{"class":496,"line":1129},[494,2021,2022],{"class":500},"    defer",[494,2024,2025],{"class":603}," pool",[494,2027,613],{"class":504},[494,2029,2030],{"class":616},"Close",[494,2032,1915],{"class":504},[494,2034,2035],{"class":496,"line":1144},[494,2036,672],{"emptyLinePlaceholder":671},[494,2038,2039,2042,2044,2046,2048,2050,2052,2054],{"class":496,"line":1193},[494,2040,2041],{"class":603},"    bunDB ",[494,2043,607],{"class":504},[494,2045,652],{"class":603},[494,2047,613],{"class":504},[494,2049,657],{"class":616},[494,2051,620],{"class":504},[494,2053,662],{"class":603},[494,2055,665],{"class":504},[494,2057,2058,2061,2063,2065,2067,2069,2071,2073],{"class":496,"line":1211},[494,2059,2060],{"class":603},"    tx ",[494,2062,607],{"class":504},[494,2064,652],{"class":603},[494,2066,613],{"class":504},[494,2068,723],{"class":616},[494,2070,620],{"class":504},[494,2072,728],{"class":603},[494,2074,665],{"class":504},[494,2076,2077],{"class":496,"line":1224},[494,2078,672],{"emptyLinePlaceholder":671},[494,2080,2081,2083,2085,2088,2090,2092,2094,2096,2098,2101,2103,2105,2107,2109,2111,2113],{"class":496,"line":1236},[494,2082,1147],{"class":603},[494,2084,607],{"class":504},[494,2086,2087],{"class":603}," tx",[494,2089,613],{"class":504},[494,2091,862],{"class":616},[494,2093,620],{"class":504},[494,2095,623],{"class":603},[494,2097,626],{"class":504},[494,2099,2100],{"class":504}," func(",[494,2102,623],{"class":1078},[494,2104,1096],{"class":508},[494,2106,613],{"class":504},[494,2108,1101],{"class":508},[494,2110,637],{"class":504},[494,2112,1122],{"class":940},[494,2114,908],{"class":504},[494,2116,2117,2120,2122,2124,2126,2128,2130,2132,2134,2136,2138,2141,2143,2146],{"class":496,"line":1250},[494,2118,2119],{"class":603},"        _",[494,2121,626],{"class":504},[494,2123,1321],{"class":603},[494,2125,607],{"class":504},[494,2127,652],{"class":603},[494,2129,613],{"class":504},[494,2131,1156],{"class":616},[494,2133,620],{"class":504},[494,2135,623],{"class":603},[494,2137,626],{"class":504},[494,2139,2140],{"class":603}," bunDB",[494,2142,1173],{"class":504},[494,2144,2145],{"class":616},"NewUpdate",[494,2147,2148],{"class":504},"().\n",[494,2150,2152,2155,2157,2159,2161,2163,2165,2168,2170,2172,2175,2177,2179,2182,2184,2186,2189,2191,2193,2195,2198,2200,2202,2204,2206,2208],{"class":496,"line":2151},25,[494,2153,2154],{"class":616},"            Table",[494,2156,620],{"class":504},[494,2158,1201],{"class":504},[494,2160,1187],{"class":924},[494,2162,1201],{"class":504},[494,2164,1173],{"class":504},[494,2166,2167],{"class":616},"Set",[494,2169,620],{"class":504},[494,2171,1201],{"class":504},[494,2173,2174],{"class":924},"stock = stock - 1",[494,2176,1201],{"class":504},[494,2178,1173],{"class":504},[494,2180,2181],{"class":616},"Where",[494,2183,620],{"class":504},[494,2185,1201],{"class":504},[494,2187,2188],{"class":924},"id = ?",[494,2190,1201],{"class":504},[494,2192,626],{"class":504},[494,2194,505],{"class":504},[494,2196,2197],{"class":924},"prod_42",[494,2199,1201],{"class":504},[494,2201,1173],{"class":504},[494,2203,1359],{"class":616},[494,2205,620],{"class":504},[494,2207,623],{"class":603},[494,2209,665],{"class":504},[494,2211,2213,2215],{"class":496,"line":2212},26,[494,2214,1543],{"class":500},[494,2216,1247],{"class":603},[494,2218,2220],{"class":496,"line":2219},27,[494,2221,2017],{"class":504},[494,2223,2225,2227,2229,2231,2233],{"class":496,"line":2224},28,[494,2226,1528],{"class":500},[494,2228,1321],{"class":603},[494,2230,1533],{"class":504},[494,2232,1536],{"class":504},[494,2234,908],{"class":504},[494,2236,2238,2241,2243,2246,2248,2251],{"class":496,"line":2237},29,[494,2239,2240],{"class":603},"        log",[494,2242,613],{"class":504},[494,2244,2245],{"class":616},"Fatal",[494,2247,620],{"class":504},[494,2249,2250],{"class":603},"err",[494,2252,665],{"class":504},[494,2254,2256],{"class":496,"line":2255},30,[494,2257,1550],{"class":504},[494,2259,2261],{"class":496,"line":2260},31,[494,2262,739],{"class":504},[514,2264,2266],{"id":2265},"patterns-used","Patterns used",[526,2268,2269,2282],{},[529,2270,2271,2274,2275,2278,2279,613],{},[477,2272,2273],{},"Unit of Work \u002F transaction in context",", the same pattern as the ",[455,2276,2277],{"href":414},"pgx stack",": ",[455,2280,238],{"href":2281},"\u002Fen\u002Fconcepts\u002Fdesign-patterns#unit-of-work--transaction-in-context",[529,2283,2284,1075,2287,582,2290,2293],{},[477,2285,2286],{},"Resolver functions",[450,2288,2289],{},"From(ctx, db)",[450,2291,2292],{},"Conn(ctx, db)","): the same \"join the context's transaction if there is one\" logic, with a bun-specific return type.",[2295,2296,2297],"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 .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 .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html pre.shiki code .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}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 .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 .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}html pre.shiki code .sbssI, html code.shiki .sbssI{--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C}",{"title":490,"searchDepth":644,"depth":644,"links":2299},[2300,2301,2302,2303,2304,2305,2306,2307,2308],{"id":516,"depth":644,"text":517},{"id":568,"depth":644,"text":569},{"id":785,"depth":644,"text":786},{"id":841,"depth":644,"text":842},{"id":1378,"depth":644,"text":1379},{"id":1700,"depth":644,"text":1701},{"id":1761,"depth":644,"text":1762},{"id":1795,"depth":644,"text":1796},{"id":2265,"depth":644,"text":2266},"The optional bun adapter: query builder and struct models, with the Transactor contract unchanged.","md",null,{},{"icon":47},{"title":417,"description":2309},"d6l_XAH1I_GVVTMclz1ApbiOHmVsTJIfuSXLaXglqzg",[2317,2319],{"title":413,"path":414,"stem":415,"description":2318,"icon":106,"children":-1},"The pgx-native database stack: the pool, the DBTX query surface and the context-aware DB executor.",{"title":421,"path":422,"stem":423,"description":2320,"icon":424,"children":-1},"Cross-repository transactions carried by the context, no plumbing.",1785445891260]