entgo

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateDriver

func CreateDriver(driverName, dsn string, enableTrace, enableMetrics bool) (*entSql.Driver, error)

CreateDriver 创建数据库驱动

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]

func (*EntClient[T]) Client

func (c *EntClient[T]) Client() T

func (*EntClient[T]) Close

func (c *EntClient[T]) Close() error

Close 关闭数据库连接

func (*EntClient[T]) DB

func (c *EntClient[T]) DB() *sql.DB

func (*EntClient[T]) Driver

func (c *EntClient[T]) Driver() *entSql.Driver

func (*EntClient[T]) Exec

func (c *EntClient[T]) Exec(ctx context.Context, query string, args, v any) error

func (*EntClient[T]) Query

func (c *EntClient[T]) Query(ctx context.Context, query string, args, v any) error

Query 查询数据

func (*EntClient[T]) SetConnectionOption

func (c *EntClient[T]) SetConnectionOption(maxIdleConnections, maxOpenConnections int, connMaxLifetime time.Duration)

SetConnectionOption 设置连接配置

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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