Documentation
¶
Overview ¶
Package postgres 是 reliable Store 的 PostgreSQL 薄方言包(D17)。 仅提供 migration SQL、PGClassifier、NewStore(db) 注入。GORM 逻辑在 store/gormshared。
Index ¶
Constants ¶
View Source
const CreateTableSQL = `` /* 6503-byte string literal not displayed */
CreateTableSQL 建 four tables(PostgreSQL 方言)。与 mysql 语义等价,类型用 PG 原生 + partial index。
View Source
const DropTableSQL = `` /* 181-byte string literal not displayed */
Variables ¶
This section is empty.
Functions ¶
func NewQuarantineStore ¶
func NewQuarantineStore(db *gorm.DB) store.QuarantineStore
Types ¶
type PGClassifier ¶
type PGClassifier struct{}
PGClassifier 实现 reliable.ErrorClassifier(§5 第 2 级,PostgreSQL SQLSTATE)。
func (PGClassifier) ClassifyDriver ¶
func (PGClassifier) ClassifyDriver(err error) (reliable.ErrorClass, bool)
func (PGClassifier) ErrorCode ¶
func (PGClassifier) ErrorCode(err error) (string, bool)
ErrorCode 提取 PostgreSQL SQLSTATE 码(如 "23505"、"40P01"),用于填充 error_code 列。 B1(本轮评审):原稿此处注释行首多一个 `n`、函数体多一层缩进,且文件缺 `store` import(下方 NewStore 返回 store.Store)——与 mysql/classify.go 同款错误,两处一并修。
func (PGClassifier) IsDuplicateKey ¶
func (PGClassifier) IsDuplicateKey(err error) bool
IsDuplicateKey 报告 err 是否是 PG unique_violation(23505)。D3:typed errors.As。
Click to show internal directories.
Click to hide internal directories.