connutil

package
v0.0.0-...-b24cf9a Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2018 License: MPL-2.0 Imports: 9 Imported by: ? modules, 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

This section is empty.

Variables

View Source
var (
	ErrNotInitialized = errors.New("connection has not been initalized")
)

Functions

This section is empty.

Types

type ConnectionProducer

type ConnectionProducer interface {
	Close() error
	Initialize(context.Context, map[string]interface{}, bool) error
	Connection(context.Context) (interface{}, error)

	sync.Locker
}

ConnectionProducer can be used as an embeded interface in the Database definition. It implements the methods dealing with individual database connections and is used in all the builtin database types.

type SQLConnectionProducer

type SQLConnectionProducer struct {
	ConnectionURL            string      `json:"connection_url" structs:"connection_url" mapstructure:"connection_url"`
	MaxOpenConnections       int         `json:"max_open_connections" structs:"max_open_connections" mapstructure:"max_open_connections"`
	MaxIdleConnections       int         `json:"max_idle_connections" structs:"max_idle_connections" mapstructure:"max_idle_connections"`
	MaxConnectionLifetimeRaw interface{} `json:"max_connection_lifetime" structs:"max_connection_lifetime" mapstructure:"max_connection_lifetime"`

	Type string

	Initialized bool

	sync.Mutex
	// contains filtered or unexported fields
}

SQLConnectionProducer implements ConnectionProducer and provides a generic producer for most sql databases

func (*SQLConnectionProducer) Close

func (c *SQLConnectionProducer) Close() error

Close attempts to close the connection

func (*SQLConnectionProducer) Connection

func (c *SQLConnectionProducer) Connection(ctx context.Context) (interface{}, error)

func (*SQLConnectionProducer) Initialize

func (c *SQLConnectionProducer) Initialize(ctx context.Context, conf map[string]interface{}, verifyConnection bool) error

Jump to

Keyboard shortcuts

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