db

package
v0.8.0-alpha Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2017 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package db provides database connections and helper functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IN

func IN(vals []string) string

["a","b"] -> "'a','b'"

Types

type ConnectionPool

type ConnectionPool struct {
	*sync.Mutex
	// contains filtered or unexported fields
}

A ConnectionPool represents a standard sql.DB connection with max open > 0.

func NewConnectionPool

func NewConnectionPool(maxOpen, maxIdle int, dsn string, tlsConfig *tls.Config) *ConnectionPool

func (*ConnectionPool) Close

func (c *ConnectionPool) Close()

func (*ConnectionPool) Connect

func (c *ConnectionPool) Connect() (*sql.DB, error)

type Connector

type Connector interface {
	Connect() (*sql.DB, error)
	Close()
}

A Connector provides a database connection. It encapsulates logic about where and how to connect, like the DSN and TLS config, so that code using a Connector does not need to know this logic. Implementations can also vary wrt connection pooling.

Jump to

Keyboard shortcuts

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