entgo

package
v0.0.0-...-f0a7105 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 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 create database driver

Types

type Client

type Client[T IClient] struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient[T IClient](db T, drv *entSql.Driver) *Client[T]

func (*Client[T]) Client

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

func (*Client[T]) Close

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

Close database connection

func (*Client[T]) DB

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

func (*Client[T]) Driver

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

func (*Client[T]) Exec

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

Exec query

func (*Client[T]) Query

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

Query data

func (*Client[T]) SetConnectionOption

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

SetConnectionOption set connection configuration

type IClient

type IClient interface {
	Close() error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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