plugin

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// 数据库类型
	// nolint:lll
	Type string `default:"sqlite3" json:"type" yaml:"type" xml:"type" toml:"type" validate:"required,oneof=mysql sqlite3 mssql oracle psql"`

	// 地址,填写服务器地址
	Addr string `default:"127.0.0.1:3306" json:"addr" yaml:"addr" xml:"addr" toml:"addr" validate:"required,hostname_port"`
	// 授权,用户名
	Username string `json:"username" yaml:"username" xml:"username" toml:"username"`
	// 授权,密码
	Password string `json:"password" yaml:"password" xml:"password" toml:"password"`
	// 连接协议
	// nolint: lll
	Protocol string `default:"tcp" json:"protocol" yaml:"protocol" xml:"protocol" toml:"password" validate:"required,oneof=tcp udp"`

	// 连接池配置
	Connection config.Connection `json:"connection" yaml:"connection" xml:"connection" toml:"connection"`

	// 表名的前缀
	Suffix string `json:"suffix" yaml:"suffix" xml:"suffix" toml:"suffix"`
	// 表名后缀
	Prefix string `json:"prefix" yaml:"prefix" xml:"prefix" toml:"prefix"`
	// 连接的数据库名
	Schema string `default:"data.db" json:"schema" yaml:"schema" xml:"schema" toml:"schema" validate:"required"`

	// 额外参数
	// nolint: lll
	Parameters string `default:"parseTime=true&loc=Local" json:"parameters" yaml:"parameters" xml:"parameters" toml:"parameters"`
	// 是否连接时测试数据库连接是否完好
	Ping bool `default:"true" json:"ping" yaml:"ping" xml:"ping" toml:"ping"`
	// 是否显示执行语句
	Show bool `default:"false" json:"show" yaml:"show" xml:"show" toml:"show"`

	// SSH代理连接
	SSH *config.Ssh `json:"ssh" yaml:"ssh" xml:"ssh" toml:"ssh"`
}

type Constructor added in v0.1.0

type Constructor struct {
}

func (*Constructor) New added in v0.1.0

func (c *Constructor) New(config *pangu.Config, logger log.Logger) (engine *db.Engine, err error)

func (*Constructor) NewTransaction added in v0.1.0

func (c *Constructor) NewTransaction(engine *db.Engine, logger log.Logger) *db.Transaction

type Wrapper

type Wrapper struct {
	// 关系型数据库配置
	Db *Config `json:"db" yaml:"db" xml:"db" toml:"db" validate:"required"`
}

Jump to

Keyboard shortcuts

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