pool

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Connection

type Connection struct {
	Pool   *DbPool
	DB     *sql.DB
	Status bool
}

Connection Database connection

func (*Connection) Close

func (conn *Connection) Close()

Close Returning a database connection to the connection pool

type DbPool

type DbPool struct {
	Url         string
	InitialSize int
	ExpandSize  int
	MaxOpen     int

	MinOpen int

	TestConn  bool
	PoolQueue DbPoolQueue
	// contains filtered or unexported fields
}

DbPool Connection Pool

func (*DbPool) Close

func (pool *DbPool) Close(conn *Connection)

Close Returning used connections to the connection pool

func (*DbPool) GetConn

func (pool *DbPool) GetConn() (*Connection, error)

GetConn Get a connection

type DbPoolQueue

type DbPoolQueue struct {
	First *DbPoolQueueItem
	Last  *DbPoolQueueItem
	Size  int
	// contains filtered or unexported fields
}

DbPoolQueue Queue

func (*DbPoolQueue) Add

func (dp *DbPoolQueue) Add(item *Connection)

Add connections to the queue

func (*DbPoolQueue) Poll

func (dp *DbPoolQueue) Poll() *Connection

Poll Taking elements out of the queue

type DbPoolQueueItem

type DbPoolQueueItem struct {
	Conn *Connection
	Next *DbPoolQueueItem
}

DbPoolQueueItem Elements inside the queue

Jump to

Keyboard shortcuts

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