datasource

package
v1.4.3 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const PropertiesPath = "application.datasource"

Variables

This section is empty.

Functions

This section is empty.

Types

type DataSource added in v1.4.3

type DataSource interface {
	bean.Bean
	Build(properties *DataSourceProperties) (DataSource, error)
	DB() interface{}
}

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) (interface{}, error)
}

type DataSourceImpl added in v1.4.3

type DataSourceImpl struct {
	types.Component
	Drivers []DataSourceDriver `wire:""`
	// contains filtered or unexported fields
}

func (*DataSourceImpl) Bean added in v1.4.3

func (d *DataSourceImpl) Bean() string

func (*DataSourceImpl) Build added in v1.4.3

func (d *DataSourceImpl) Build(properties *DataSourceProperties) (DataSource, error)

func (*DataSourceImpl) DB added in v1.4.3

func (d *DataSourceImpl) DB() interface{}

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 DataSourceStarter added in v1.4.3

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

func NewStarter

func NewStarter() *DataSourceStarter

func (*DataSourceStarter) AfterInit added in v1.4.3

func (d *DataSourceStarter) AfterInit()

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) (interface{}, error)

Jump to

Keyboard shortcuts

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