common

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2020 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MysqlKeywordEscapeCharStart       = "`"
	MysqlKeywordEscapeCharEnd         = "`"
	MysqlEscapeKeywordEscapeCharStart = "`"
	MysqlEscapeKeywordEscapeCharEnd   = "`"

	PostgresKeywordEscapeCharStart       = `"`
	PostgresKeywordEscapeCharEnd         = `"`
	PostgresEscapeKeywordEscapeCharStart = `\"`
	PostgresEscapeKeywordEscapeCharEnd   = `\"`

	SqlServerKeywordEscapeCharStart       = `[`
	SqlServerKeywordEscapeCharEnd         = `]`
	SqlServerEscapeKeywordEscapeCharStart = `[`
	SqlServerEscapeKeywordEscapeCharEnd   = `]`

	DummyKeywordEscapeCharStart       = ""
	DummyKeywordEscapeCharEnd         = ""
	DummyEscapeKeywordEscapeCharStart = ""
	DummyEscapeKeywordEscapeCharEnd   = ""
)
View Source
const (
	MethodFlag         = "method"
	OutPutSuffixMethod = "output"
	GenerateMethod     = "generate"
)

Variables

View Source
var EscapeKeywordEscapeCharEnd = DummyEscapeKeywordEscapeCharEnd
View Source
var EscapeKeywordEscapeCharStart = DummyEscapeKeywordEscapeCharStart
View Source
var KeywordEscapeCharEnd = DummyKeywordEscapeCharEnd
View Source
var KeywordEscapeCharStart = DummyKeywordEscapeCharStart

Functions

func Camel2snake

func Camel2snake(s string) string

snake string, XxYy to xx_yy , XxYY to xx_yy

func Column2DynamicName

func Column2DynamicName(tableName, column string) string

func Column2Modelfield

func Column2Modelfield(column string) string

func ColumnSpace

func ColumnSpace() string

func CommonEscapeKeywordFormatter

func CommonEscapeKeywordFormatter(src string) string

func CommonKeywordFormatter

func CommonKeywordFormatter(src string) string

func Newline

func Newline() string

func SelectKeywordFormatter

func SelectKeywordFormatter(driver string)

func Snake2camel

func Snake2camel(s string) string

camel string, xx_yy to XxYy

func TableName2ModelName

func TableName2ModelName(tableName string) string

Types

type DBDriver

type DBDriver interface {
	Open(driver, info string) error
	Close() error

	QueryTableInfo(dbName, tableName string) ([]ModelInfo, error)
	QueryTableNames(dbName string) ([]string, error)
}

type GenerateInfo

type GenerateInfo struct {
	Driver  string      `json:"driver"`
	Package string      `json:"package"`
	Table   string      `json:"table"`
	Models  []ModelInfo `json:"models"`
}

type KeywordFormatter

type KeywordFormatter func(string) string

type ModelInfo

type ModelInfo struct {
	ColumnName string
	DataType   string
	Nullable   string
	ColumnKey  string
	Comment    string
	Tag        string
}

type PluginResult

type PluginResult struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

Jump to

Keyboard shortcuts

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