sql

package
v1.0.0-dev.187 Latest Latest
Warning

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

Go to latest
Published: May 15, 2025 License: MIT Imports: 6 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	PluginsRoot = root + ".plugins"
)

Variables

This section is empty.

Functions

func ConfigAdd

func ConfigAdd(path string)

func NewDBWithOptions

func NewDBWithOptions(
	ctx context.Context,
	connector driver.Connector,
	options *Options,
	plugins []Plugin,
) (*sql.DB, error)

Types

type Options

type Options struct {
	ConnMaxLifetime time.Duration
	ConnMaxIdletime time.Duration
	MaxIdletime     int
	MaxOpenConns    int
}

Options represents a godror options.

func NewOptions

func NewOptions() (*Options, error)

NewOptions returns options from config file or environment vars.

func NewOptionsWithPath

func NewOptionsWithPath(path string) (opts *Options, err error)

NewOptionsWithPath unmarshals a given key path into options and returns it.

type Plugin

type Plugin interface {
	// WrapConnector é chamado antes de abrir o *sql.DB*,
	// pra você trocar o driver/connector se quiser.
	WrapConnector(ctx context.Context, connector driver.Connector) (driver.Connector, error)
	// InitDB é chamado logo depois de abrir o *sql.DB*,
	// pra você configurar métricas ou outros hooks.
	InitDB(ctx context.Context, db *sql.DB) error
}

Directories

Path Synopsis
plugins

Jump to

Keyboard shortcuts

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