generator

package module
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2023 License: MIT Imports: 16 Imported by: 1

README

generator

代码生成器。 参考 google.golang.org/protobuf

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsStandard

func IsStandard(p string) bool

IsStandard 是否为标准库包

func Run

func Run(fn func(gen *Plugin)) error

Run .

Types

type Package added in v1.1.2

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

Package is the import path of a Go package. for example: "google.golang.org/protobuf/compiler/protogen"

func NewPackage added in v1.1.2

func NewPackage(pkg string) *Package

NewPackage . 简洁包名例如: "github.com/pkg/errors", 程序可以自处理 alias 复杂包名例如: "github.com/redis/go-redis/v9", "github.com/robfig/cron/v3", 需手动调用 Alias(),否则会导致生成的文件出错

func (*Package) Alias added in v1.1.2

func (exp *Package) Alias(alias string) *Package

Alias .

type Plugin

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

Plugin .

func (*Plugin) NewFile added in v1.1.0

func (p *Plugin) NewFile(name string, path string, exts ...*Package) *compiler

NewFile .

Jump to

Keyboard shortcuts

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