gen_method

package
v0.0.0-...-61829c1 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2019 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BatchFetchTemplate = `` /* 853-byte string literal not displayed */
View Source
var CreateTemplate = `` /* 1968-byte string literal not displayed */
View Source
var DbFiledTemplate = `` /* 5043-byte string literal not displayed */
View Source
var FetchByUniqueInexTemplate = `` /* 858-byte string literal not displayed */
View Source
var FetchListTemplate = `` /* 2035-byte string literal not displayed */
View Source
var FetchTemplate = `` /* 754-byte string literal not displayed */
View Source
var TableNameTemplate = `` /* 992-byte string literal not displayed */

Functions

func IsSpecifyIndexSequence

func IsSpecifyIndexSequence(fields []Field) bool

func ParseIndex

func ParseIndex(index string) (string, int, bool)

ParseIndex indexName[0] -> return indexname, 0

func ParseTagSetting

func ParseTagSetting(str string) map[string][]string

Types

type BaseInfoOfGenCode

type BaseInfoOfGenCode struct {
	PartFuncName   string
	FuncInputParam string
	OrmQueryFormat string
	OrmQueryParam  string
}

type BatchFetchTemplateParam

type BatchFetchTemplateParam struct {
	FetchTemplateParam
	FieldType        string
	ParamField       string
	ReceiverListName string
	StructListName   string
}

type DbFieldTempalteParam

type DbFieldTempalteParam struct {
	StructName            string
	ReceiverName          string
	NewStructFields       []string
	NewStructValue        []string
	NoUniqueIndexFields   []string
	StructFieldAndDBField []string
	DBFieldAndStructField []string
	EnabledFieldType      string
	UpdateTimeFieldType   string
	CreateTimeFieldType   string
	HasEnabledField       bool
	HasUpdateTimeField    bool
	HasCreateTimeField    bool
}

type FetchListTemplateParam

type FetchListTemplateParam struct {
	ReceiverListName   string
	StructListName     string
	StructName         string
	HasEnabledField    bool
	HasCreateTimeField bool
	DbCreateTimeField  string
	DbEnabledField     string
}

type FetchTemplateParam

type FetchTemplateParam struct {
	TableNameTemplateParam
	Field            string
	DbField          string
	ReceiverListName string
	StructListName   string
}

type Field

type Field struct {
	Name                string
	Type                string
	DbFieldName         string
	IndexName           string
	IndexNumber         int
	IsEnable            bool
	IsCreateTime        bool
	IsSpecifyIndexOrder bool
}

type Model

type Model struct {
	Pkg                 *types.Package
	Name                string
	Fields              []*Field
	IsDbModel           bool
	UniqueIndex         map[string][]Field
	NormalIndex         map[string][]Field
	PrimaryIndex        []Field
	HasCreateTimeField  bool
	HasUpdateTimeField  bool
	HasEnabledField     bool
	EnabledFieldType    string
	CreateTimeFieldType string
	UpdateTimeFieldType string
	DbCreateTimeField   string
	DbEnabledField      string
	DbUpdateTimeField   string
	FuncMapContent      map[string]string
	Deps                []string
}

func (*Model) GenerateFile

func (model *Model) GenerateFile()

func (*Model) Output

func (model *Model) Output(pkgName string, ignoreCreateTableNameFunc bool)

type Scanner

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

func NewScanner

func NewScanner(packagePath string) *Scanner

func (*Scanner) Output

func (s *Scanner) Output(modelName string, ignoreTable bool)

type TableNameTemplateParam

type TableNameTemplateParam struct {
	BaseInfoOfGenCode
	StructName              string
	ReceiverName            string
	PackageName             string
	HasCreateTimeField      bool
	HasUpdateTimeField      bool
	HasEnabledField         bool
	EnabledFieldType        string
	CreateTimeFieldType     string
	UpdateTimeFieldType     string
	DbEnabledField          string
	DbCreateTimeField       string
	DbUpdateTimeField       string
	NeedCreateTableNameFunc bool
	TableNameStr            string
	GlobalPkgPath           string
}

type UniqueDeleteTemplateParam

type UniqueDeleteTemplateParam struct {
	TableNameTemplateParam
	UnionField string
}

type UniqueFetchTemplateParam

type UniqueFetchTemplateParam struct {
	TableNameTemplateParam
	UnionField string
}

type UniquePhysicsDeleteTemplateParam

type UniquePhysicsDeleteTemplateParam struct {
	TableNameTemplateParam
	UnionField string
}

type UniqueUpdateWithMapTemplateParam

type UniqueUpdateWithMapTemplateParam struct {
	TableNameTemplateParam
	UnionField string
}

type UniqueUpdateWithStructTemplateParam

type UniqueUpdateWithStructTemplateParam struct {
	TableNameTemplateParam
	UnionField string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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