Documentation
¶
Index ¶
- func CreateDriver(driverName, dsn string, enableTrace, enableMetrics bool) (*entSql.Driver, error)
- func QueryAllChildrenIds[T EntClientInterface](ctx context.Context, entClient *EntClient[T], tableName string, ...) ([]uint32, error)
- func Rollback[T Rollbacker](tx T, err error) error
- type EntClient
- func (c *EntClient[T]) Client() T
- func (c *EntClient[T]) Close() error
- func (c *EntClient[T]) DB() *sql.DB
- func (c *EntClient[T]) Driver() *entSql.Driver
- func (c *EntClient[T]) Exec(ctx context.Context, query string, args, v any) error
- func (c *EntClient[T]) Query(ctx context.Context, query string, args, v any) error
- func (c *EntClient[T]) SetConnectionOption(maxIdleConnections, maxOpenConnections int, connMaxLifetime time.Duration)
- type EntClientInterface
- type Rollbacker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateDriver ¶
CreateDriver 创建数据库驱动
func QueryAllChildrenIds ¶ added in v1.1.33
func QueryAllChildrenIds[T EntClientInterface](ctx context.Context, entClient *EntClient[T], tableName string, parentID uint32) ([]uint32, error)
QueryAllChildrenIds 使用CTE递归查询所有子节点ID
func Rollback ¶ added in v1.1.33
func Rollback[T Rollbacker](tx T, err error) error
Rollback calls to tx.Rollback and wraps the given error
Types ¶
type EntClient ¶
type EntClient[T EntClientInterface] struct { // contains filtered or unexported fields }
func NewEntClient ¶
func NewEntClient[T EntClientInterface](db T, drv *entSql.Driver) *EntClient[T]
type EntClientInterface ¶ added in v1.1.16
type EntClientInterface interface {
Close() error
}
type Rollbacker ¶ added in v1.1.33
type Rollbacker interface {
Rollback() error
}
Click to show internal directories.
Click to hide internal directories.