gen

package
v1.1.10 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2021 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Category added in v1.1.1

func Category() string

Category returns model const value

func Clean added in v1.0.22

func Clean() error

Clean deletes all template files

func GenTemplates added in v1.0.22

func GenTemplates(_ *cli.Context) error

GenTemplates creates template files if not exists

func NewDefaultGenerator added in v1.0.4

func NewDefaultGenerator(dir string, cfg *config.Config, opt ...Option) (*defaultGenerator, error)

NewDefaultGenerator creates an instance for defaultGenerator

func RevertTemplate added in v1.0.22

func RevertTemplate(name string) error

RevertTemplate recovers the delete template files

func Update added in v1.0.22

func Update() error

Update provides template clean and init

Types

type Join added in v1.1.5

type Join []string

Join describes an alias of string slice

func (Join) Camel added in v1.1.5

func (j Join) Camel() Join

Camel convert items into Camel and return

func (Join) Lower added in v1.1.5

func (j Join) Lower() Join

Lower convert items into Lower and return

func (Join) Snake added in v1.1.5

func (j Join) Snake() Join

Snake convert items into Snake and return

func (Join) Title added in v1.1.5

func (j Join) Title() Join

Title convert items into Title and return

func (Join) Untitle added in v1.1.5

func (j Join) Untitle() Join

Untitle converts items into Untitle and return

func (Join) Upper added in v1.1.5

func (j Join) Upper() Join

Upper convert items into Upper and return

func (Join) With added in v1.1.5

func (j Join) With(sep string) stringx.String

With convert items into With and return

type Key

type Key struct {
	// VarLeft describes the variable of cache key expression which likes cacheUserIdPrefix
	VarLeft string
	// VarRight describes the value of cache key expression which likes "cache:user:id:"
	VarRight string
	// VarExpression describes the cache key expression which likes cacheUserIdPrefix = "cache:user:id:"
	VarExpression string
	// KeyLeft describes the variable of key definition expression which likes userKey
	KeyLeft string
	// KeyRight describes the value of key definition expression which likes fmt.Sprintf("%s%v", cacheUserPrefix, user)
	KeyRight string
	// DataKeyRight describes data key likes fmt.Sprintf("%s%v", cacheUserPrefix, data.User)
	DataKeyRight string
	// KeyExpression describes key expression likes userKey := fmt.Sprintf("%s%v", cacheUserPrefix, user)
	KeyExpression string
	// DataKeyExpression describes data key expression likes userKey := fmt.Sprintf("%s%v", cacheUserPrefix, data.User)
	DataKeyExpression string
	// FieldNameJoin describes the filed slice of table
	FieldNameJoin Join
	// Fields describes the fields of table
	Fields []*parser.Field
}

Key describes cache key

type Option added in v1.0.4

type Option func(generator *defaultGenerator)

Option defines a function with argument defaultGenerator

func WithConsoleOption added in v1.0.4

func WithConsoleOption(c console.Console) Option

WithConsoleOption creates a console option

func WithPostgreSql added in v1.1.10

func WithPostgreSql() Option

WithPostgreSql marks defaultGenerator.isPostgreSql true

type Table added in v1.0.4

type Table struct {
	parser.Table
	PrimaryCacheKey        Key
	UniqueCacheKey         []Key
	ContainsUniqueCacheKey bool
}

Table defines mysql table

Jump to

Keyboard shortcuts

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