gen

package
v0.0.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Category

func Category() string

Category returns model const value

func Clean

func Clean() error

Clean deletes all template files

func GenTemplates

func GenTemplates(_ *cli.Context) error

GenTemplates creates template files if not exists

func NewDefaultGenerator

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

NewDefaultGenerator creates an instance for defaultGenerator

func RevertTemplate

func RevertTemplate(name string) error

RevertTemplate recovers the delete template files

func Update

func Update() error

Update provides template clean and init

Types

type Join

type Join []string

Join describes an alias of string slice

func (Join) Camel

func (j Join) Camel() Join

Camel convert items into Camel and return

func (Join) Lower

func (j Join) Lower() Join

Lower convert items into Lower and return

func (Join) Snake

func (j Join) Snake() Join

Snake convert items into Snake and return

func (Join) Title

func (j Join) Title() Join

Title convert items into Title and return

func (Join) Untitle

func (j Join) Untitle() Join

Untitle converts items into Untitle and return

func (Join) Upper

func (j Join) Upper() Join

Upper convert items into Upper and return

func (Join) With

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

type Option func(generator *defaultGenerator)

Option defines a function with argument defaultGenerator

func WithConsoleOption

func WithConsoleOption(c console.Console) Option

WithConsoleOption creates a console option

type Table

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