sql

package
v0.0.0-...-56027fb Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultMaxNumConnOpen = 5
	DefaultMaxNumConnIdle = 2
)

Variables

View Source
var (
	ClickHouseSQL = row.NewProtocol("ClickHouseSQL")
	MySQL         = row.NewProtocol("MySQL")
	PostgreSQL    = row.NewProtocol("PostgreSQL")
)
View Source
var (
	ErrDatabaseNotReady = errors.New("not ready")
)

Functions

This section is empty.

Types

type ClickHouseConfig

type ClickHouseConfig struct {
	Instance       string
	Addr           string
	AlterAddr      string
	Port           string
	InstanceConfig InstanceConfig
}

func (ClickHouseConfig) GetAddr

func (c ClickHouseConfig) GetAddr() string

func (ClickHouseConfig) GetAlterAddr

func (c ClickHouseConfig) GetAlterAddr() string

func (ClickHouseConfig) GetInstance

func (c ClickHouseConfig) GetInstance() string

func (ClickHouseConfig) GetInstanceConfig

func (c ClickHouseConfig) GetInstanceConfig() InstanceConfig

func (ClickHouseConfig) GetModel

func (c ClickHouseConfig) GetModel() row.Model

func (ClickHouseConfig) GetPort

func (c ClickHouseConfig) GetPort() string

func (ClickHouseConfig) GetProtocol

func (c ClickHouseConfig) GetProtocol() row.Protocol

type Config

type Config interface {
	GetModel() row.Model
	GetProtocol() row.Protocol
	GetInstance() string
	GetAddr() string
	GetAlterAddr() string
	GetPort() string
	GetInstanceConfig() InstanceConfig
}

type Database

type Database interface {
	Init(Config) error
	Close() error
	Get() (*sql.DB, error)
}

func NewClickHouseDatabase

func NewClickHouseDatabase() Database

func NewMySQLDatabase

func NewMySQLDatabase() Database

func NewPostgresDatabase

func NewPostgresDatabase() Database

type InstanceConfig

type InstanceConfig struct {
	Username       string
	Password       string
	ConnectTimeout int
	ReadTimeout    int
	WriteTimeout   int
	MaxOpen        int
	MaxIdle        int

	// PostgreSQL exclusive
	SSLMode string

	// MySQL exclusive
	Charset string
}

type MySQLConfig

type MySQLConfig struct {
	Instance       string
	Addr           string
	AlterAddr      string
	Port           string
	InstanceConfig InstanceConfig
}

func (MySQLConfig) GetAddr

func (c MySQLConfig) GetAddr() string

func (MySQLConfig) GetAlterAddr

func (c MySQLConfig) GetAlterAddr() string

func (MySQLConfig) GetInstance

func (c MySQLConfig) GetInstance() string

func (MySQLConfig) GetInstanceConfig

func (c MySQLConfig) GetInstanceConfig() InstanceConfig

func (MySQLConfig) GetModel

func (c MySQLConfig) GetModel() row.Model

func (MySQLConfig) GetPort

func (c MySQLConfig) GetPort() string

func (MySQLConfig) GetProtocol

func (c MySQLConfig) GetProtocol() row.Protocol

type PostgresConfig

type PostgresConfig struct {
	Instance       string
	Addr           string
	Port           string
	InstanceConfig InstanceConfig
}

func (PostgresConfig) GetAddr

func (c PostgresConfig) GetAddr() string

func (PostgresConfig) GetAlterAddr

func (c PostgresConfig) GetAlterAddr() string

func (PostgresConfig) GetInstance

func (c PostgresConfig) GetInstance() string

func (PostgresConfig) GetInstanceConfig

func (c PostgresConfig) GetInstanceConfig() InstanceConfig

func (PostgresConfig) GetModel

func (c PostgresConfig) GetModel() row.Model

func (PostgresConfig) GetPort

func (c PostgresConfig) GetPort() string

func (PostgresConfig) GetProtocol

func (c PostgresConfig) GetProtocol() row.Protocol

Jump to

Keyboard shortcuts

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