cmd

package
v0.0.0-...-e1dabad Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Copyright © 2020 NAME HERE <EMAIL ADDRESS>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright © 2020 NAME HERE <EMAIL ADDRESS>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright © 2020 NAME HERE <EMAIL ADDRESS>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

View Source
var DBTypeToStructTypeDbrInfo = map[string]string{
	"int":        "dbr.NullInt64",
	"tinyint":    "dbr.NullInt64",
	"smallint":   "dbr.NullInt64",
	"bigint":     "dbr.NullInt64",
	"varchar":    "dbr.NullString",
	"text":       "dbr.NullString",
	"mediumtext": "dbr.NullString",
	"json":       "dbr.NullString",
	"longtext":   "dbr.NullString",
	"char":       "dbr.NullString",
	"timestamp":  "dbr.NullTime",
	"datetime":   "dbr.NullTime",
	"date":       "dbr.NullTime",
	"time":       "dbr.NullTime",
	"double":     "dbr.NullFloat64",
	"decimal":    "dbr.NullFloat64",
	"float":      "dbr.NullFloat64",
}
View Source
var DBTypeToStructTypeInfo = map[string]string{
	"int":        "int64",
	"tinyint":    "int8",
	"smallint":   "int16",
	"bigint":     "int64",
	"varchar":    "string",
	"text":       "string",
	"mediumtext": "string",
	"json":       "string",
	"longtext":   "string",
	"char":       "string",
	"timestamp":  "time.Time",
	"datetime":   "time.Time",
	"date":       "time.Time",
	"time":       "time.Time",
	"double":     "float64",
	"decimal":    "float64",
	"float":      "float64",
}

Functions

func Execute

func Execute()

Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

func ToCamel

func ToCamel(s string) string

Types

type DBInfo

type DBInfo struct {
	Host     string
	UserName string
	Password string
	DataBase string
	Port     string
}

type DBModel

type DBModel struct {
	DB     *sqlx.DB
	DBInfo DBInfo
}

func (*DBModel) ConnectMysql

func (d *DBModel) ConnectMysql() error

func (*DBModel) GetColumns

func (d *DBModel) GetColumns(dbName, tableName string) ([]TableInfo, error)

type StringBool

type StringBool string
const (
	StringBoolYes StringBool = "YES"
	StringBoolNO  StringBool = "NO"
)

type StructTpl

type StructTpl struct {
	TableName string
	TagAround string
	IsGorm    bool
	Class     string
	Columns   []TableInfo
}

func (*StructTpl) Parse

func (s *StructTpl) Parse()

type TableInfo

type TableInfo struct {
	ColumnName    string     `db:"COLUMN_NAME" json:"column_name"`
	IsNullable    StringBool `db:"IS_NULLABLE" json:"is_nullable"`
	DataType      string     `db:"DATA_TYPE" json:"data_type"`
	ColumnComment string     `db:"COLUMN_COMMENT" json:"column_comment"`
	StructType    string     `db:"-" json:"-"`
	TagAround     string     `db:"-" json:"-"`
}

Jump to

Keyboard shortcuts

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