gen

package
v0.0.0-...-a699295 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2020 License: MIT Imports: 16 Imported by: 1

Documentation

Index

Constants

View Source
const EmptyImport = protogen.GoImportPath("")

Variables

This section is empty.

Functions

func GoFmt

func GoFmt(raw []byte) []byte

func IsWrap

func IsWrap(s string, quotes ...string) bool

func LowerName

func LowerName(name string) string

小写下划线

func ParseTags

func ParseTags(tags ...string) map[string]string

func Run

func Run(plugin *protogen.Plugin) error

func Trim

func Trim(s string, cuts ...rune) string

func UpperName

func UpperName(name string) string

大写驼峰

func Wrap

func Wrap(s string, quotes ...string) string

Types

type Comment

type Comment struct {
	LeadingDetached []string
	Leading         string
	Trailing        string
}

注释

func (Comment) PrintLeading

func (c Comment) PrintLeading(prefix string) string

func (Comment) PrintTrailing

func (c Comment) PrintTrailing(prefix string) string

type Enum

type Enum struct {
	Name   string
	Fields []EnumField
	Comment
}

type EnumField

type EnumField struct {
	Name  string
	Value string
	Index int
	Comment
}

type File

type File struct {
	Path       string
	Package    string
	ApiPrefix  string
	ImportPath string
	ImportMap  map[string]string
	Imports    []Import
	Enums      []Enum
	Messages   []Message
	Services   []Service
}

func ParseFile

func ParseFile(gf *protogen.File) File

func (File) JsType

func (File) JsType(goType string) string

func (File) LowerName

func (File) LowerName(name string) string

func (File) UpperName

func (File) UpperName(name string) string

type Import

type Import struct {
	Object  string //引用的对象 model
	Package string //引用包名
	Path    string //引用包名
}

type Message

type Message struct {
	Name   string
	Fields []MessageField
	Comment
}

type MessageField

type MessageField struct {
	Name    string
	JsName  string
	Type    string
	IsArray bool
	MapKey  string
	Pointer bool
	Index   int
	Comment
}

func (MessageField) GoFieldType

func (field MessageField) GoFieldType() string

func (MessageField) JSFieldType

func (field MessageField) JSFieldType() string

type Param

type Param map[string]string

func ParseParam

func ParseParam(s string) Param

func (Param) Encode

func (p Param) Encode() string

func (Param) Get

func (p Param) Get(key string) string

func (Param) GetBool

func (p Param) GetBool(key string) bool

func (Param) Set

func (p Param) Set(key, val string)

type Service

type Service struct {
	Name    string
	Methods []ServiceMethod
	Comment
}

type ServiceMethod

type ServiceMethod struct {
	Name   string
	Input  string
	Output string
	Comment
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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