datasource

package
v1.3.8 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2021 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UseDataBaseHandler

func UseDataBaseHandler(typ string, handler DataBaseConnectionHandler)

Types

type Config

type Config struct {
	bean.Component

	Type            string `yaml:"type"`
	Host            string `yaml:"host"`
	Database        string `yaml:"database"`
	Username        string `yaml:"username"`
	Password        string `yaml:"password"`
	Tunnel          string `yaml:"tunnel"`
	ConnMaxLifeTime int64  `yaml:"max_life_time"`
	ConnMaxIdleTime int64  `yaml:"max_idle_time"`
	MaxIdleConns    int    `yaml:"max_idle_conn"`
	MaxOpenConns    int    `yaml:"max_open_conn"`
	LazyFetch       bool   `yaml:"lazy_fetch"`
	// contains filtered or unexported fields
}

func (*Config) Prefix

func (c *Config) Prefix() string

type DataBaseConnectionHandler

type DataBaseConnectionHandler func(d *Starter, configure Datasource) (*sql.DB, error)

type Datasource

type Datasource interface {
	bean.Bean
	Tag() string
	GetType() string
	GetHost() string
	GetDatabase() string
	GetUsername() string
	GetPassword() string
	GetTunnel() string

	GetConnMaxLifeTime() int64
	GetConnMaxIdleTime() int64
	GetMaxIdleConns() int
	GetMaxOpenConns() int
	IsLazyFetch() bool
}

type Helper

type Helper struct {
	// contains filtered or unexported fields
}

func NewHelper

func NewHelper() *Helper

func (*Helper) CreateDatasource

func (d *Helper) CreateDatasource() (Datasource, error)

func (*Helper) SetDatasourceTag

func (d *Helper) SetDatasourceTag(datasource string) *Helper

func (*Helper) SetPropertiesPrefix

func (d *Helper) SetPropertiesPrefix(prefix string) *Helper

type ORMUpgrader

type ORMUpgrader interface {
	bean.Bean
	UpgradeType() reflect.Type
	Upgrade(wrapper Wrapper) (interface{}, error)
}

type Starter

type Starter struct {
	bean.Component
	Config     ssh.Config `value:"ssh"`
	Log        log.Logger
	TCPDialer  *tcp.Dialer `not:""`
	SSHDialer  *ssh.Dialer `not:""`
	Datasource []Datasource
	Repos      []component.Repository

	Upgraders []ORMUpgrader
	// contains filtered or unexported fields
}

func NewStarter

func NewStarter() *Starter

func (*Starter) Init

func (s *Starter) Init() error

type Wrapper

type Wrapper interface {
	DB() *sql.DB
	Configure() Datasource
}

Jump to

Keyboard shortcuts

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