gen

package
v0.0.0-...-87bc42c Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2024 License: GPL-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EscapeGolangKeyword

func EscapeGolangKeyword(s string) string

func NewGenerator

func NewGenerator(dir string) (*defaultGenerator, error)

# TODO: i think it is not good to return an error in constructor func NewGenerator create generator for generate Code

func Title

func Title(s string) string

Title 将字符串首字母改为大写

func ToCamel

func ToCamel(s string) string

ToCamel 将字符串改为驼峰式

func Untitle

func Untitle(s string) string

Untitle 将字符串首字母改为小写

Types

type Code

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

type CodeTuple

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

type Generator

type Generator interface {
}

type Join

type Join []string

func (Join) Camel

func (j Join) Camel() Join

func (Join) Title

func (j Join) Title() Join

func (Join) Upper

func (j Join) Upper() Join

func (Join) With

func (j Join) With(sep string) string

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

type Table

type Table struct {
	parser.Table
	PrimaryCacheKey        Key
	UniqueCacheKey         []Key
	ContainsUniqueCacheKey bool
	// contains filtered or unexported fields
}

Table

Jump to

Keyboard shortcuts

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