gen

package
v1.0.50 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2020 License: MIT Imports: 18 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	NamingLower = "lower"
	NamingCamel = "camel"
	NamingSnake = "snake"
)

Variables

View Source
var ErrCircleQuery = errors.New("circle query with other fields")

Functions

func Clean

func Clean() error

func GenTemplates

func GenTemplates(_ *cli.Context) error

func GetCategory

func GetCategory() string

func NewDefaultGenerator

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

func RevertTemplate

func RevertTemplate(name string) error

func Update

func Update(category string) error

Types

type Key

type Key struct {
	VarExpression     string // cacheUserIdPrefix = "cache#User#id#"
	Left              string // cacheUserIdPrefix
	Right             string // cache#user#id#
	Variable          string // userIdKey
	KeyExpression     string // userIdKey: = fmt.Sprintf("cache#user#id#%v", userId)
	DataKeyExpression string // userIdKey: = fmt.Sprintf("cache#user#id#%v", data.userId)
	RespKeyExpression string // userIdKey: = fmt.Sprintf("cache#user#id#%v", resp.userId)
}

tableName:user {{prefix}}=cache key:id

type Option

type Option func(generator *defaultGenerator)

func WithConsoleOption

func WithConsoleOption(c console.Console) Option

type Table

type Table struct {
	parser.Table
	CacheKey          map[string]Key
	ContainsUniqueKey bool
}

Jump to

Keyboard shortcuts

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