datasource

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2023 License: MIT Imports: 2 Imported by: 16

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Configuration

type Configuration struct {

	// URL      string
	Name            string `inject:"${datasource.default.name}"` // the name of DataSource
	TableNamePrefix string `inject:"${datasource.default.table-name-prefix}"`
	TableNameSuffix string `inject:"${datasource.default.table-name-suffix}"`

	Host     string `inject:"${datasource.default.host}"`
	Port     int    `inject:"${datasource.default.port}"`
	Driver   string `inject:"${datasource.default.driver}"`
	Username string `inject:"${datasource.default.username}"`
	Password string `inject:"${datasource.default.password}"`
	Database string `inject:"${datasource.default.database}"`
}

Configuration 是数据源的配置

type Driver

type Driver interface {
	Accept(cfg *Configuration) bool
	Open(cfg *Configuration) (Source, error)
}

Driver 是数据源驱动

type DriverManager added in v0.0.5

type DriverManager interface {
	FindDriver(cfg *Configuration) (Driver, error)
	OpenSource(cfg *Configuration) (Source, error)
}

DriverManager 是驱动管理器

[inject:"#starter-gorm-driver-manager"]

type DriverRegistration added in v0.0.8

type DriverRegistration struct {
	Driver Driver
}

DriverRegistration ...

type DriverRegistry added in v0.0.8

type DriverRegistry interface {
	GetRegistration() *DriverRegistration
}

DriverRegistry ... [inject:".starter-gorm-driver-registry"]

type Source

type Source interface {
	io.Closer

	DB() (*gorm.DB, error)
}

Source 是数据源

type SourceManager added in v0.0.8

type SourceManager interface {
	GetSource(name string) (Source, error)
}

SourceManager ... [inject:"#starter-gorm-source-manager"]

type SourceRegistration added in v0.0.8

type SourceRegistration struct {
	Name   string
	Source Source
}

SourceRegistration ...

type SourceRegistry added in v0.0.8

type SourceRegistry interface {
	ListSources() []*SourceRegistration
}

SourceRegistry ... [inject:".starter-gorm-source-registry"]

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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