pool

package
v0.0.0-...-4f0bb4a Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2018 License: LGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrClosed is the error resulting if the pool is closed via pool.Close() or pool.Release().
	ErrClosed = errors.New("pool is closed")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	// init conn size
	InitialSize int
	// the max conn size
	MaxActive int

	Factory func() (interface{}, error)
	Close   func(interface{}) error
	// the idle timeout
	IdleTimetout time.Duration
}

Config the connection pool config

type Pool

type Pool interface {
	// Get get conn from pool
	Get() (interface{}, error)

	// Put conn into pool
	Put(interface{}) error

	// Close the conn
	Close(interface{}) error

	// Release release all conn in pool
	Release()

	// Size the size of the pool conn
	Size() int
}

Pool dv conn pool

func New

func New(c *Config) (Pool, error)

New create a new Pool config

Jump to

Keyboard shortcuts

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