generator

package
v2.23.13 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2023 License: MIT Imports: 12 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	StructName string
	TableName  string
	Database   string

	WithComments        bool
	WithTableName       bool
	WithTableInterfaces bool
	WithMethods         bool

	FieldPrimaryKey   string
	FieldKeyDeletedAt string
	FieldKeyCreatedAt string
	FieldKeyUpdatedAt string
}

func (*Config) SetDefaults

func (g *Config) SetDefaults()

type Keys

type Keys struct {
	Primary       []string
	Indexes       builder.Indexes
	UniqueIndexes builder.Indexes
}

func (*Keys) Bind

func (ks *Keys) Bind(table *builder.Table)

func (*Keys) PatchUniqueIndexesWithSoftDelete

func (ks *Keys) PatchUniqueIndexesWithSoftDelete(softDeleteField string)

type Model

type Model struct {
	*types.TypeName
	*Config
	*Keys
	*builder.Table
	Fields                map[string]*types.Var
	FieldKeyAutoIncrement string
	HasDeletedAt          bool
	HasCreatedAt          bool
	HasUpdatedAt          bool
	HasAutoIncrement      bool
}

func NewModel

func NewModel(pkg *packagesx.Package, typeName *types.TypeName, comments string, cfg *Config) *Model

func (*Model) FieldType

func (m *Model) FieldType(file *codegen.File, fieldName string) codegen.SnippetType

func (*Model) GetColDescriptions added in v2.5.0

func (m *Model) GetColDescriptions() map[string][]string

func (*Model) GetComments

func (m *Model) GetComments() map[string]string

func (*Model) GetRelations added in v2.3.0

func (m *Model) GetRelations() map[string][]string

func (*Model) IndexFieldNames

func (m *Model) IndexFieldNames() []string

func (*Model) IteratorType added in v2.12.3

func (m *Model) IteratorType() codegen.SnippetType

func (*Model) PtrType

func (m *Model) PtrType() codegen.SnippetType

func (*Model) Type

func (m *Model) Type() codegen.SnippetType

func (*Model) VarTable

func (m *Model) VarTable() string

func (*Model) WriteBatchList

func (m *Model) WriteBatchList(file *codegen.File)

func (*Model) WriteByKey

func (m *Model) WriteByKey(file *codegen.File)

func (*Model) WriteCRUD

func (m *Model) WriteCRUD(file *codegen.File)

func (*Model) WriteCount

func (m *Model) WriteCount(file *codegen.File)

func (*Model) WriteCreate

func (m *Model) WriteCreate(file *codegen.File)

func (*Model) WriteDelete

func (m *Model) WriteDelete(file *codegen.File)

func (*Model) WriteList

func (m *Model) WriteList(file *codegen.File)

func (*Model) WriteTableInterfaces

func (m *Model) WriteTableInterfaces(file *codegen.File)

func (*Model) WriteTableKeyInterfaces

func (m *Model) WriteTableKeyInterfaces(file *codegen.File)

func (*Model) WriteTableName added in v2.8.2

func (m *Model) WriteTableName(file *codegen.File)

func (*Model) WriteTo

func (m *Model) WriteTo(file *codegen.File)

type SqlFuncGenerator

type SqlFuncGenerator struct {
	Config
	// contains filtered or unexported fields
}

func NewSqlFuncGenerator

func NewSqlFuncGenerator(pkg *packagesx.Package) *SqlFuncGenerator

func (*SqlFuncGenerator) Output

func (g *SqlFuncGenerator) Output(cwd string)

func (*SqlFuncGenerator) Scan

func (g *SqlFuncGenerator) Scan()

Directories

Path Synopsis
__examples__

Jump to

Keyboard shortcuts

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