maker_protobuf

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2022 License: MulanPSL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TmplDefineST = &generator.TemplateHeader{
	Name:     "protobuf_define_st",
	Filepath: "protobuf_define_st.tmpl",

	BuiltinTemplateText: `
{{if (ne .DocComment "")}}{{.DocComment}}
{{end}}message {{.Name}} {{"{"}}{{range .Fields}}
{{if (ne .DocComment "")}}    {{.DocComment}}
{{end}}    {{.TypeStr}} {{.Name}} = {{.Sequence}};{{if (ne .LineComment "")}} {{.LineComment}}{{end}}{{end}}
}
`,
}
View Source
var TmplProtoFile = &generator.TemplateHeader{
	Name:     "protobuf_proto_file",
	Filepath: "protobuf_proto_file.tmpl",

	BuiltinTemplateText: `syntax = "proto3";

package {{.Package}};
{{range $key, $value := .Options}}option {{$key}} = "{{$value}}";
{{end}}{{if (len .Import | ne 0)}}{{range .Import}}import "{{.}}";
{{end}}{{end}}{{range .DefineSTCode}}{{.}}{{end}}
`,
}

Functions

func GenCodeForDefineST

func GenCodeForDefineST(pSet *generator.PrototypeSet, df *generator.DefineST) (string, []string, error)

func GenFileForProto

func GenFileForProto(pSet *generator.PrototypeSet, origFn string) (string, error)

func GenSetForProto

func GenSetForProto(pSet *generator.PrototypeSet) ([]string, error)

Types

type GenConfig

type GenConfig struct {
	ProtoDir     string
	ProtoPackage string

	ProtoOptions map[string]string

	Plugins []string
}
var GenCFG *GenConfig

type PBField

type PBField struct {
	Name  string
	PBSeq int
}

type TmplDefineSTData added in v0.2.0

type TmplDefineSTData struct {
	Name string

	DocComment string
	Fields     []*TmplDefineSTDataField

	Plugins map[string]interface{}
}

type TmplDefineSTDataField added in v0.2.0

type TmplDefineSTDataField struct {
	Name        string
	TypeStr     string
	Sequence    int
	DocComment  string
	LineComment string

	Plugins map[string]interface{}
}

type TmplProtoFileData added in v0.2.0

type TmplProtoFileData struct {
	Import  []string
	Package string
	Options map[string]string

	DefineSTCode []string

	Plugins map[string]interface{}
}

Jump to

Keyboard shortcuts

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