datasource

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 26, 2021 License: MIT Imports: 4 Imported by: 16

Documentation

Index

Constants

View Source
const DriversClassName = "gorm-db-drivers"

Variables

This section is empty.

Functions

This section is empty.

Types

type Configuration

type Configuration struct {
	// URL      string
	Name     string // the name of DataSource
	Host     string
	Port     int
	Driver   string
	Username string
	Password string
	Database string
}

type Driver

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

type DriverRegistrar

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

func (*DriverRegistrar) GetDriverByName

func (inst *DriverRegistrar) GetDriverByName(name string) (Driver, error)

func (*DriverRegistrar) Open

func (inst *DriverRegistrar) Open(cfg *Configuration) (Source, error)

func (*DriverRegistrar) Register

func (inst *DriverRegistrar) Register(name string, driver Driver)

type Drivers

type Drivers interface {
	GetDriverByName(name string) (Driver, error)
	Open(cfg *Configuration) (Source, error)
}

Drivers class='gorm-db-drivers'

type GormDataSource

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

func (*GormDataSource) Close

func (inst *GormDataSource) Close() error

func (*GormDataSource) Config

func (inst *GormDataSource) Config(cfg *GormStarterConfig) error

func (*GormDataSource) Configuration

func (inst *GormDataSource) Configuration() *Configuration

func (*GormDataSource) DB

func (inst *GormDataSource) DB() *gorm.DB

func (*GormDataSource) Name

func (inst *GormDataSource) Name() string

func (*GormDataSource) Open

func (inst *GormDataSource) Open() error

type GormDataSourceBuilder

type GormDataSourceBuilder struct {
	// DSN       string
	Dialector gorm.Dialector
	Config1   *Configuration
	Config2   *gorm.Config
}

func (*GormDataSourceBuilder) Create

func (inst *GormDataSourceBuilder) Create() (Source, error)

type GormStarterConfig

type GormStarterConfig struct {
	DataSourceName string

	Context application.Context
}

type Source

type Source interface {
	Name() string
	DB() *gorm.DB
	Configuration() *Configuration
}

Directories

Path Synopsis
data
这个文件是由 starter-configen 工具生成的配置代码,千万不要手工修改里面的任何内容。
这个文件是由 starter-configen 工具生成的配置代码,千万不要手工修改里面的任何内容。

Jump to

Keyboard shortcuts

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