schema

package
v1.2.5 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2020 License: MIT Imports: 4 Imported by: 5

Documentation

Index

Constants

View Source
const (
	IMPORT_GOGO_PROTO = `import "github.com/gogo/protobuf/gogoproto/gogo.proto";`
	IMPORT_SQLCA      = `import "github.com/civet148/sqlca"`
)

Variables

This section is empty.

Functions

func CamelCaseConvert added in v1.1.13

func CamelCaseConvert(strIn string) (strOut string)

func CreateOutputFile added in v1.1.13

func CreateOutputFile(cmd *Commander, table *TableSchema, strFileSuffix string, append bool) (file *os.File, err error)

func GetDatabaseName added in v1.1.13

func GetDatabaseName(strPath string) (strName string)

func IsInSlice added in v1.1.6

func IsInSlice(in string, s []string) bool

func MakeGetter added in v1.1.6

func MakeGetter(strStructName, strColName, strColType string) (strGetter string)

func MakeSetter added in v1.1.6

func MakeSetter(strStructName, strColName, strColType string) (strSetter string)

func MakeTags added in v1.1.6

func MakeTags(strColName, strColType, strTagValue, strComment string, strAppends string) string

func ReplaceCRLF added in v1.1.6

func ReplaceCRLF(strIn string) (strOut string)

func TrimSpaceSlice added in v1.1.13

func TrimSpaceSlice(s []string) (ts []string)

Types

type Commander added in v1.1.6

type Commander struct {
	ConnUrl        string
	Database       string
	Tables         []string
	Without        []string
	ReadOnly       []string
	Tags           []string
	Scheme         string
	Host           string
	User           string
	Password       string
	Charset        string
	OutDir         string
	Prefix         string
	Suffix         string
	PackageName    string
	Protobuf       bool
	DisableDecimal bool
	OneFile        bool
	GogoOptions    []string
}

type TableColumn added in v1.1.6

type TableColumn struct {
	Name         string `json:"COLUMN_NAME" db:"COLUMN_NAME"`
	DataType     string `json:"DATA_TYPE" db:"DATA_TYPE"`
	Key          string `json:"COLUMN_KEY" db:"COLUMN_KEY"`
	Extra        string `json:"EXTRA" db:"EXTRA"`
	Comment      string `json:"COLUMN_COMMENT" db:"COLUMN_COMMENT"`
	IsPrimaryKey bool   // is primary key
	IsDecimal    bool   // is decimal type
	IsReadOnly   bool   // is read only
	GoName       string //column name in golang
	GoType       string //column type in golang
}

type TableSchema added in v1.1.6

type TableSchema struct {
	SchemeName   string        `json:"TABLE_SCHEMA" db:"TABLE_SCHEMA"`   //database name
	TableName    string        `json:"TABLE_NAME" db:"TABLE_NAME"`       //table name
	TableEngine  string        `json:"ENGINE" db:"ENGINE"`               //database engine
	TableComment string        `json:"TABLE_COMMENT" db:"TABLE_COMMENT"` //comment of table schema
	SchemeDir    string        `json:"SCHEMA_DIR" db:"SCHEMA_DIR"`       //output path
	PkName       string        `json:"PK_NAME" db:"PK_NAME"`             //primary key column name
	StructName   string        `json:"STRUCT_NAME" db:"STRUCT_NAME"`     //struct name
	OutDir       string        `json:"OUT_DIR" db:"OUT_DIR"`             //output directory
	FileName     string        `json:"FILE_NAME" db:"FILE_NAME"`         //output directory
	Columns      []TableColumn `json:"TABLE_COLUMNS" db:"TABLE_COLUMNS"` //columns with database and golang
}

Jump to

Keyboard shortcuts

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