codegen

package
v1.0.0-alpha.5 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2024 License: MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TagOptionAutoIncrement tagOption = "auto_increment"
	TagOptionBinary        tagOption = "binary"
	TagOptionPKAlias       tagOption = "pk"
	TagOptionPK            tagOption = "primary_key"
	TagOptionFKAlias       tagOption = "fk"
	TagOptionFK            tagOption = "foreign_key"
	TagOptionUnsigned      tagOption = "unsigned"
	TagOptionSize          tagOption = "size"
	TagOptionDataType      tagOption = "data_type"
	TagOptionEncode        tagOption = "encode"
	TagOptionDecode        tagOption = "decode"
	TagOptionUnique        tagOption = "unique"
)

Variables

This section is empty.

Functions

func Generate

func Generate(c *config.Config) error

func Init

func Init(cfg *config.Config) error

Types

type EmptyMatcher

type EmptyMatcher struct{}

func (*EmptyMatcher) Match

func (*EmptyMatcher) Match(v string) bool

type Expr

type Expr string

func (Expr) Format

func (e Expr) Format(pkg *Package, args ...any) string

type FieldTypeValueResult

type FieldTypeValueResult struct {
	FuncName string
	Type     string
	Valuer   string
	Value    string
}

type FileMatcher

type FileMatcher map[string]struct{}

func (FileMatcher) Match

func (f FileMatcher) Match(v string) bool

type Generator

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

func (Generator) IsStaticVar

func (g Generator) IsStaticVar() bool

func (Generator) Quote

func (g Generator) Quote(v string) string

func (Generator) QuoteIdentifier

func (g Generator) QuoteIdentifier(v string) string

func (Generator) QuoteStringBegin

func (g Generator) QuoteStringBegin() string

func (Generator) QuoteStringEnd

func (g Generator) QuoteStringEnd() string

func (Generator) QuoteVar

func (g Generator) QuoteVar(i int) string

type Mapping

type Mapping struct {
	Encoder Expr
	Decoder Expr
}

func UnderlyingType

func UnderlyingType(t types.Type) (*Mapping, bool)

type Matcher

type Matcher interface {
	Match(v string) bool
}

type Package

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

func NewPackage

func NewPackage(path, name string) *Package

func (*Package) Import

func (p *Package) Import(pkg *types.Package) (*types.Package, bool)

func (Package) Name

func (p Package) Name() string

func (Package) PkgPath

func (p Package) PkgPath() string

type RegexMatcher

type RegexMatcher struct {
	*regexp.Regexp
}

func (*RegexMatcher) Match

func (r *RegexMatcher) Match(v string) bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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