dialect

package
v1.4.9 Latest Latest
Warning

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

Go to latest
Published: May 10, 2022 License: LGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const DIALECT_DEFAULT_HOST = "127.0.0.1"
View Source
const FLASHDB_DEFAULT_PORT uint16 = 8000
View Source
const MYSQL_DEFAULT_PORT uint16 = 3306
View Source
const PGSQL_DEFAULT_PORT uint16 = 5432
View Source
const REDIS_DEFAULT_PORT uint16 = 6379

Variables

View Source
var (
	ConcatWith = utils.ConcatWith
	WrapWith   = utils.WrapWith
	Escape     = url.QueryEscape
)

Functions

func GetAccount

func GetAccount(username, password string) string

func GetAddr

func GetAddr(host string, port uint16) string

Types

type ConnConfig

type ConnConfig struct {
	Type     string     `hcl:"type,label" json:"type"`
	Key      string     `hcl:"key,label" json:"key"`
	LogFile  string     `hcl:"log_file,optional" json:"log_file,omitempty"`
	Username string     `hcl:"username,optional" json:"username,omitempty"`
	Password string     `hcl:"password,optional" json:"password,omitempty"`
	DSN      string     `hcl:"dsn,optional" json:"dsn,omitempty"`
	Options  url.Values `hcl:"options,optional" json:"options,omitempty"`
	Remain   hcl.Body   `hcl:",remain"`
	Dialect  Dialect
}

连接配置

func (ConnConfig) GetDSN

func (c ConnConfig) GetDSN(full bool) string

func (*ConnConfig) LoadDialect

func (c *ConnConfig) LoadDialect() Dialect

func (ConnConfig) Name

func (c ConnConfig) Name() string

func (ConnConfig) QuickConnect added in v1.4.2

func (c ConnConfig) QuickConnect(verbose bool) *xorm.Engine

QuickConnect 连接数据库,需要先导入对应驱动

type Dialect

type Dialect interface {
	Name() string
	ImporterPath() string
	IsXormDriver() bool
	QuoteIdent(ident string) string
	BuildDSN() string
	BuildFullDSN(username, password string) string
}

func GetDialectByName

func GetDialectByName(name string) Dialect

type FlashDB

type FlashDB struct {
	Path             string `hcl:"path,optional" json:"path,omitempty"`
	EvictionInterval int    `hcl:"eviction_interval,optional" json:"eviction_interval,omitempty"`
}

func (FlashDB) BuildDSN

func (d FlashDB) BuildDSN() string

func (FlashDB) BuildFullDSN

func (d FlashDB) BuildFullDSN(username, password string) string

func (FlashDB) ImporterPath

func (FlashDB) ImporterPath() string

func (FlashDB) IsXormDriver added in v1.4.2

func (FlashDB) IsXormDriver() bool

func (FlashDB) Name

func (FlashDB) Name() string

func (FlashDB) QuoteIdent

func (FlashDB) QuoteIdent(ident string) string

type Mysql

type Mysql struct {
	Host     string `hcl:"host" json:"host"`
	Port     uint16 `hcl:"port,optional" json:"port,omitempty"`
	Database string `hcl:"database,optional" json:"database,omitempty"`
}

func (Mysql) BuildDSN

func (d Mysql) BuildDSN() string

func (Mysql) BuildFullDSN

func (d Mysql) BuildFullDSN(username, password string) string

func (Mysql) ImporterPath

func (Mysql) ImporterPath() string

func (Mysql) IsXormDriver added in v1.4.2

func (Mysql) IsXormDriver() bool

func (Mysql) Name

func (Mysql) Name() string

func (Mysql) QuoteIdent

func (Mysql) QuoteIdent(ident string) string

type Postgres

type Postgres struct {
	Host     string `hcl:"host" json:"host"`
	Port     uint16 `hcl:"port,optional" json:"port,omitempty"`
	Database string `hcl:"database,optional" json:"database,omitempty"`
}

func (Postgres) BuildDSN

func (d Postgres) BuildDSN() string

func (Postgres) BuildFullDSN

func (d Postgres) BuildFullDSN(username, password string) string

func (Postgres) ImporterPath

func (Postgres) ImporterPath() string

func (Postgres) IsXormDriver added in v1.4.2

func (Postgres) IsXormDriver() bool

func (Postgres) Name

func (Postgres) Name() string

func (Postgres) QuoteIdent

func (Postgres) QuoteIdent(ident string) string

type Redis

type Redis struct {
	Host     string `hcl:"host" json:"host"`
	Port     uint16 `hcl:"port,optional" json:"port,omitempty"`
	Database int    `hcl:"database,optional" json:"database,omitempty"`
}

func (Redis) BuildDSN

func (d Redis) BuildDSN() string

func (Redis) BuildFullDSN

func (d Redis) BuildFullDSN(username, password string) string

func (Redis) ImporterPath

func (Redis) ImporterPath() string

func (Redis) IsXormDriver added in v1.4.2

func (Redis) IsXormDriver() bool

func (Redis) Name

func (Redis) Name() string

func (Redis) QuoteIdent

func (Redis) QuoteIdent(ident string) string

type Sqlite

type Sqlite struct {
	Path string `hcl:"path,optional" json:"path"`
}

func (Sqlite) BuildDSN

func (d Sqlite) BuildDSN() string

func (Sqlite) BuildFullDSN

func (d Sqlite) BuildFullDSN(username, password string) string

func (Sqlite) ImporterPath

func (Sqlite) ImporterPath() string

func (Sqlite) IsXormDriver added in v1.4.2

func (Sqlite) IsXormDriver() bool

func (Sqlite) Name

func (Sqlite) Name() string

func (Sqlite) QuoteIdent

func (Sqlite) QuoteIdent(ident string) string

Jump to

Keyboard shortcuts

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