pgtxbypass

package
v0.12.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 27, 2026 License: MIT Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package pgtxbypass 禁止绕过 pgtx.From(ctx, pool) 直接在 *pgxpool.Pool 上执行 SQL。

在 appkit 架构中,事务句柄(tx.Do)、分区域域的 SET LOCAL search_path 与租户域的 SET LOCAL app.tenant_id 都绑定在事务上下文中;业务数据访问必须走 sqlc.New(pgtx.From(ctx, s.pool))(见 AGENTS.md 与 DESIGN §5.5/§8)。 直接在 *pgxpool.Pool 上调用 Query / QueryRow / Exec / SendBatch / CopyFrom 会静默绕过当前事务、分区路由与 RLS 策略。 Ping / Begin / BeginTx / Acquire / Close / Stat / Config 等连接池管理方法不受限制。

默认只查非生成生产代码(_test.go 与生成文件不查),-tests=true 连测试一起查。 确需直连连接池(如建库工具/基础设施初始化)时,用 //appkit:ignore pgtxbypass -- <理由> 豁免。

Index

Constants

This section is empty.

Variables

View Source
var Analyzer = &analysis.Analyzer{
	Name: "pgtxbypass",
	Doc:  "禁止直接调用 (*pgxpool.Pool).Query/QueryRow/Exec/SendBatch/CopyFrom;请经 pgtx.From(ctx, pool) 执行以保留事务、分区路由与租户 RLS 上下文",
	Run:  run,
}

Analyzer 是 pgtxbypass 检查器。

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL