datasource

package
v1.4.4 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const PropertiesPath = "application.datasource"

Variables

This section is empty.

Functions

func MustBindDB added in v1.4.4

func MustBindDB(db DB) *sql.DB

Types

type BeanDBAware added in v1.4.4

type BeanDBAware interface {
	bean.Bean
	DataSource() string
	SetDB(db DB)
}

type DB added in v1.4.4

type DB interface{}

type DBAwarePostProcessorBean added in v1.4.4

type DBAwarePostProcessorBean struct {
	types.Component `name:"db_aware_post_processor_bean"`
	DataSources     []DataSource `wire:""`
}

func (*DBAwarePostProcessorBean) PostProcessorAfterInitialization added in v1.4.4

func (p *DBAwarePostProcessorBean) PostProcessorAfterInitialization(bean interface{}, beanName string) error

func (*DBAwarePostProcessorBean) PostProcessorBeforeInitialization added in v1.4.4

func (p *DBAwarePostProcessorBean) PostProcessorBeforeInitialization(bean interface{}, beanName string) error

type DataSource added in v1.4.3

type DataSource interface {
	bean.Bean
	DB() DB
}

func NewDataSource added in v1.4.3

func NewDataSource(name ...string) DataSource

type DataSourceDriver added in v1.4.3

type DataSourceDriver interface {
	bean.Bean
	Type() string
	Driver() string
	Open(properties *DataSourceProperties) (DB, error)
}

type DataSourceProperties added in v1.4.3

type DataSourceProperties struct {
	types.AutoConfigure `name:"datasource_properties" prefix:"application.datasource"`
	Type                string `yaml:"type"`
	Driver              string `yaml:"driver"`
	ConnMaxLifeTime     int64  `yaml:"max_life_time"`
	ConnMaxIdleTime     int64  `yaml:"max_idle_time"`
	MaxIdleConns        int    `yaml:"max_idle_conn"`
	MaxOpenConns        int    `yaml:"max_open_conn"`
	Url                 string `yaml:"url"`
	Username            string `yaml:"username"`
	Password            string `yaml:"password"`
}

type MySqlDriver added in v1.4.3

type MySqlDriver struct {
	types.DataSourceDriver `name:"datasource_driver:mysql" type:"database/sql" driver:"github.com/go-sql-driver/mysql"`
}

func (*MySqlDriver) Open added in v1.4.3

func (d *MySqlDriver) Open(properties *DataSourceProperties) (DB, error)

Jump to

Keyboard shortcuts

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