mysql

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ProviderName mysql
	ProviderName = "mysql"

	// TableNamesScript 取表名列表sql语句
	TableNamesScript = `
	SELECT
		TABLE_NAME
	FROM
		information_schema.TABLES
	WHERE TABLE_SCHEMA = DATABASE()
	`
	// TableColumnsScript 取表字段信息sql语句
	TableColumnsScript = `` /* 486-byte string literal not displayed */

)

Variables

View Source
var TypeMapping db.TypeMappingFunc = func(lang string, typ string, isNull bool) string {
	if lang == "csharp" {
		if t, ok := csharpMapping[typ]; ok {
			if isNull == false || t == "byte[]" || t == "string" {
				return t
			}

			return t + "?"
		}
	} else if lang == "golang" {
		if isNull == false {
			if t, ok := golangMapping[typ]; ok {
				return t
			}
		} else {
			if t, ok := golangNullMapping[typ]; ok {
				return t
			}
		}
	}

	return "unknown"
}

TypeMapping MySQL type mapping

Functions

func New

func New(connStr string) (db.Provider, error)

New 创建数据源实例

Types

type Provider

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

Provider MySQL数据源

func (*Provider) GetTable

func (p *Provider) GetTable(tableName string) (*db.Table, error)

GetTable 根据表名取表信息

func (*Provider) GetTableNames

func (p *Provider) GetTableNames() ([]string, error)

GetTableNames 取表名列表

Jump to

Keyboard shortcuts

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