mysqlr

package
v2.8.3 Latest Latest
Warning

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

Go to latest
Published: May 8, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SupportedFieldTypes = map[string]string{
	"bool":      "bool",
	"int":       "int32",
	"int8":      "int8",
	"int16":     "int16",
	"int32":     "int32",
	"int64":     "int64",
	"uint":      "uint32",
	"uint8":     "uint8",
	"uint16":    "uint16",
	"uint32":    "uint32",
	"uint64":    "uint64",
	"float32":   "float32",
	"float64":   "float64",
	"string":    "string",
	"datetime":  "datetime",
	"timestamp": "timestamp",
	"timeint":   "timeint",
}

Functions

func Add

func Add(a, b int) int

func Camel2Name

func Camel2Name(s string) string

func CamelName

func CamelName(argName string) string

func Divide

func Divide(a, b int) int

func GenerateConfTemplate

func GenerateConfTemplate(output string, packageName string) error

func GenerateGoTemplate

func GenerateGoTemplate(output string, obj *MetaObject) error

func GenerateScriptTemplate

func GenerateScriptTemplate(output string, driver string, obj *MetaObject) error

func Multiply

func Multiply(a, b int) int

func Sub

func Sub(a, b int) int

Types

type Field

type Field struct {
	Name string
	Type string

	Size      int
	Flags     set.Set
	Attrs     map[string]string
	Comment   string
	Validator string
	Obj       *MetaObject
	Default   interface{}
	// contains filtered or unexported fields
}

func NewField

func NewField() *Field

func (*Field) ColumnName

func (f *Field) ColumnName() string

func (*Field) FieldName

func (f *Field) FieldName() string

func (*Field) GetGoType

func (f *Field) GetGoType() string

func (*Field) GetName

func (f *Field) GetName() string

func (*Field) GetNames

func (f *Field) GetNames() string

func (*Field) GetNullSQLType

func (f *Field) GetNullSQLType() string

func (*Field) GetTag

func (f *Field) GetTag() string

func (*Field) GetTransform

func (f *Field) GetTransform() *Transform

func (*Field) GetTransformValue

func (f *Field) GetTransformValue(prefix string) string

func (*Field) GetType

func (f *Field) GetType() string

func (*Field) GetUnderlineName added in v2.4.1

func (f *Field) GetUnderlineName() string

func (*Field) GetUnderlineNames added in v2.4.1

func (f *Field) GetUnderlineNames() string

func (*Field) HasIndex

func (f *Field) HasIndex() bool

func (*Field) IsAutoIncrement

func (f *Field) IsAutoIncrement() bool

func (*Field) IsBool

func (f *Field) IsBool() bool

func (*Field) IsEncode

func (f *Field) IsEncode() bool

func (*Field) IsFullText

func (f *Field) IsFullText() bool

func (*Field) IsIndex

func (f *Field) IsIndex() bool

func (*Field) IsNeedTransform

func (f *Field) IsNeedTransform() bool

func (*Field) IsNorange

func (f *Field) IsNorange() bool

func (*Field) IsNullable

func (f *Field) IsNullable() bool

func (*Field) IsNullablePrimitive

func (f *Field) IsNullablePrimitive() bool

func (*Field) IsNumber

func (f *Field) IsNumber() bool

func (*Field) IsPrimary

func (f *Field) IsPrimary() bool

func (*Field) IsRange

func (f *Field) IsRange() bool

func (*Field) IsString

func (f *Field) IsString() bool

func (*Field) IsTime

func (f *Field) IsTime() bool

func (*Field) IsUnique

func (f *Field) IsUnique() bool

func (*Field) NullSQLTypeNeedCast

func (f *Field) NullSQLTypeNeedCast() bool

func (*Field) NullSQLTypeValue

func (f *Field) NullSQLTypeValue() string

func (*Field) Read

func (f *Field) Read(data generator.Schema) error

func (*Field) SQLColumn

func (f *Field) SQLColumn() string

! field SQL script functions

func (*Field) SQLDefault

func (f *Field) SQLDefault() string

func (*Field) SQLName

func (f *Field) SQLName() string

func (*Field) SQLNull

func (f *Field) SQLNull() string

func (*Field) SQLType

func (f *Field) SQLType() string

func (*Field) SetType

func (f *Field) SetType(t string) error

type Fields

type Fields []*Field

func (Fields) GetConstructor

func (fs Fields) GetConstructor() string

func (Fields) GetFieldNames added in v2.4.0

func (fs Fields) GetFieldNames() string

func (Fields) GetFuncParam

func (fs Fields) GetFuncParam() string

func (Fields) GetObjectParam

func (fs Fields) GetObjectParam() string

type Index

type Index struct {
	Name       string
	PrettyName string
	Fields     []*Field
	FieldNames []string
	Obj        *MetaObject
}

func NewIndex

func NewIndex(obj *MetaObject) *Index

func (*Index) FirstField

func (idx *Index) FirstField() *Field

func (*Index) GetConstructor

func (idx *Index) GetConstructor() string

func (*Index) GetFieldNames added in v2.4.0

func (idx *Index) GetFieldNames() string

func (*Index) GetFuncName

func (idx *Index) GetFuncName() string

func (*Index) GetFuncParam

func (idx *Index) GetFuncParam() string

func (*Index) GetPrettyName added in v2.6.10

func (idx *Index) GetPrettyName() string

func (*Index) HasPrimaryKey

func (idx *Index) HasPrimaryKey() bool

func (*Index) IsSingleField

func (idx *Index) IsSingleField() bool

func (*Index) LastField

func (idx *Index) LastField() *Field

type IndexArray

type IndexArray []*Index

type MetaObject

type MetaObject struct {
	//! package name
	// Package is deprecated, use Namespace instead.
	Package   string
	GoPackage string
	Namespace string
	//! model name
	Name string
	Tag  string
	//! dbs
	Db string

	//! database
	DbName  string
	DbTable string
	DbView  string

	//! importSQL
	ImportSQL string
	// contains filtered or unexported fields
}

func NewMetaObject

func NewMetaObject(namespace string, packageName string) *MetaObject

func (*MetaObject) Comment

func (m *MetaObject) Comment() string

func (*MetaObject) DbSource

func (o *MetaObject) DbSource() string

func (*MetaObject) FieldByName

func (o *MetaObject) FieldByName(name string) *Field

func (*MetaObject) Fields

func (o *MetaObject) Fields() []*Field

func (*MetaObject) FieldsMap

func (o *MetaObject) FieldsMap() map[string]generator.IField

func (*MetaObject) FromDB

func (o *MetaObject) FromDB() string

func (*MetaObject) GetTable

func (o *MetaObject) GetTable() string

func (*MetaObject) Indexes

func (o *MetaObject) Indexes() []*Index

func (*MetaObject) LastField

func (o *MetaObject) LastField() *Field

func (*MetaObject) NoneIncrementFields

func (o *MetaObject) NoneIncrementFields() []*Field

func (*MetaObject) NotPrimaryIndexes added in v2.6.9

func (o *MetaObject) NotPrimaryIndexes() []*Index

func (*MetaObject) NotPrimaryUniques added in v2.6.9

func (o *MetaObject) NotPrimaryUniques() []*Index

func (*MetaObject) PrimaryField

func (o *MetaObject) PrimaryField() *Field

func (*MetaObject) PrimaryKey

func (o *MetaObject) PrimaryKey() *PrimaryKey

func (*MetaObject) Ranges

func (o *MetaObject) Ranges() []*Index

func (*MetaObject) Read

func (o *MetaObject) Read(name string, data generator.Schema) error

func (*MetaObject) Uniques

func (o *MetaObject) Uniques() []*Index

type MySQLRGenerator

type MySQLRGenerator struct{}

func (*MySQLRGenerator) DriverName

func (g *MySQLRGenerator) DriverName() string

func (*MySQLRGenerator) Generate

func (g *MySQLRGenerator) Generate(meta generator.TMetadata) error

type PrimaryKey

type PrimaryKey struct {
	Name       string
	FieldNames []string
	Fields     []*Field
	Obj        *MetaObject
}

func NewPrimaryKey

func NewPrimaryKey(obj *MetaObject) *PrimaryKey

func (*PrimaryKey) FirstField

func (pk *PrimaryKey) FirstField() *Field

func (*PrimaryKey) GetConstructor

func (pk *PrimaryKey) GetConstructor() string

func (*PrimaryKey) GetFuncParam

func (pk *PrimaryKey) GetFuncParam() string

func (*PrimaryKey) GetObjectParam

func (pk *PrimaryKey) GetObjectParam() string

func (*PrimaryKey) IsAutoIncrement

func (pk *PrimaryKey) IsAutoIncrement() bool

func (*PrimaryKey) IsRange

func (pk *PrimaryKey) IsRange() bool

func (*PrimaryKey) IsSingleField

func (pk *PrimaryKey) IsSingleField() bool

func (*PrimaryKey) SQLColumn

func (pk *PrimaryKey) SQLColumn() string

type Transform

type Transform struct {
	TypeOrigin  string
	ConvertTo   string
	TypeTarget  string
	ConvertBack string
}

Jump to

Keyboard shortcuts

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