Documentation
¶
Overview ¶
Package gormx 是 data 门面子包:SQL/GORM 增强——Open/连接池/审计与 OTel 插件/日志/分页/单例仓储/事务。
re-export 自 github.com/oekit/gormx:类型为泛型 type alias(与源包**完全同一类型**, 双向赋值互通);非泛型函数/变量经 var 引用同一函数值。源包新增导出符号时 本壳需同步(门面跟版税,data 门面化决策已接受)。
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var InTransactionContext = src.InTransactionContext
View Source
var IsUniqueViolation = src.IsUniqueViolation
View Source
var NewAuditPlugin = src.NewAuditPlugin
View Source
var NewDefaultLogger = src.NewDefaultLogger
View Source
var NewFilterBuilder = src.NewFilterBuilder
View Source
var NewLogger = src.NewLogger
View Source
var Open = src.Open
View Source
var OpenMySQL = src.OpenMySQL
View Source
var PaginateScope = src.PaginateScope
View Source
var WithConnMaxIdleTime = src.WithConnMaxIdleTime
View Source
var WithConnectionPool = src.WithConnectionPool
View Source
var WithGormOptions = src.WithGormOptions
Functions ¶
This section is empty.
Types ¶
type AuditModel ¶
type AuditModel = src.AuditModel
type AuditPlugin ¶
type AuditPlugin = src.AuditPlugin
type FilterBuilder ¶
type FilterBuilder = src.FilterBuilder
type MySQLConfig ¶
type MySQLConfig = src.MySQLConfig
type OpenOption ¶
type OpenOption = src.OpenOption
type PageResponse ¶
type PageResponse[T any] = src.PageResponse[T]
func Paginate ¶
func Paginate[T any](db *gorm.DB, req *pagination.PageRequest, queryFn func(db *gorm.DB) *gorm.DB) (*PageResponse[T], error)
Paginate 分页查询(泛型函数无法 var re-export,经包装转发)。
type SingletonRepo ¶
type SingletonRepo[T Model] = src.SingletonRepo[T]
func NewSingletonRepo ¶
func NewSingletonRepo[T Model](db *gorm.DB, defaultVal func() T) *SingletonRepo[T]
NewSingletonRepo 创建单例仓储(事务 + FOR UPDATE 防丢更新)。
type SoftDeleteModel ¶
type SoftDeleteModel = src.SoftDeleteModel
Click to show internal directories.
Click to hide internal directories.