Documentation
¶
Index ¶
- func CreateDriver(driverName, dsn string, enableTrace, enableMetrics bool) (*entSql.Driver, error)
- type ClientInterface
- type ClientWrapper
- func (c *ClientWrapper[T]) Client() T
- func (c *ClientWrapper[T]) Close() error
- func (c *ClientWrapper[T]) DB() *sql.DB
- func (c *ClientWrapper[T]) Driver() *entSql.Driver
- func (c *ClientWrapper[T]) Exec(ctx context.Context, query string, args, v any) error
- func (c *ClientWrapper[T]) Query(ctx context.Context, query string, args, v any) error
- func (c *ClientWrapper[T]) SetConnectionOption(maxIdleConnections, maxOpenConnections int, connMaxLifetime time.Duration)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ClientInterface ¶
type ClientInterface interface {
Close() error
}
type ClientWrapper ¶
type ClientWrapper[T ClientInterface] struct { // contains filtered or unexported fields }
func NewEntClient ¶
func NewEntClient[T ClientInterface](cfg *conf.Bootstrap, l *log.Helper, db T) *ClientWrapper[T]
NewEntClient 创建Ent ORM数据库客户端
func NewEntClientWrapper ¶
func NewEntClientWrapper[T ClientInterface](db T, drv *entSql.Driver) *ClientWrapper[T]
func (*ClientWrapper[T]) Client ¶
func (c *ClientWrapper[T]) Client() T
func (*ClientWrapper[T]) DB ¶
func (c *ClientWrapper[T]) DB() *sql.DB
func (*ClientWrapper[T]) Driver ¶
func (c *ClientWrapper[T]) Driver() *entSql.Driver
func (*ClientWrapper[T]) SetConnectionOption ¶
func (c *ClientWrapper[T]) SetConnectionOption(maxIdleConnections, maxOpenConnections int, connMaxLifetime time.Duration)
SetConnectionOption 设置连接配置
Click to show internal directories.
Click to hide internal directories.