build

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AnchorFilter

func AnchorFilter(str string) string

AnchorFilter replaces all special characters with URL friendly dashes

func CommandBuild

func CommandBuild() *cobra.Command

CommandBuild is used to compile proto files proto-gen-doc build -o ../doc ../proto

func ExecuteCommand

func ExecuteCommand(target, output string) (string, error)

func IncFilter

func IncFilter(content int) template.HTML

IncFilter TODO

func NoBrFilter

func NoBrFilter(content string) template.HTML

NoBrFilter removes single CR and LF from content.

func PFilter

func PFilter(content string) template.HTML

PFilter splits the content by new lines and wraps each one in a <p> tag.

func ParaFilter

func ParaFilter(content string) string

ParaFilter splits the content by new lines and wraps each one in a <para> tag.

func RawFilter

func RawFilter(content string) template.HTML

RawFilter TODO

Types

type Enum

type Enum struct {
	File        *File        `json:"-"`
	Name        string       `json:"name"`
	LongName    string       `json:"longName"`
	FullName    string       `json:"fullName"`
	Description string       `json:"description"`
	Values      []*EnumValue `json:"values"`
	Options     Options      `json:"options,omitempty"`
}

Enum TODO

func (Enum) Option

func (e Enum) Option(name string) *ValidatorExtension

Option returns the named option.

func (Enum) ValueOptions

func (e Enum) ValueOptions() []string

ValueOptions returns all options that are set on the values in this enum.

func (Enum) ValuesWithOption

func (e Enum) ValuesWithOption(optionName string) []*EnumValue

ValuesWithOption returns all values that have the given option set. If no single value has the option set, this returns nil.

type EnumValue

type EnumValue struct {
	Name        string  `json:"name"`
	Number      string  `json:"number"`
	Description string  `json:"description"`
	Options     Options `json:"options,omitempty"`
}

EnumValue TODO

func (EnumValue) Option

func (v EnumValue) Option(name string) *ValidatorExtension

Option returns the named option.

type File

type File struct {
	Dir           string           `json:"-"`
	Name          string           `json:"name"`
	Description   string           `json:"description"`
	Package       string           `json:"package"`
	HasEnums      bool             `json:"hasEnums"`
	HasExtensions bool             `json:"hasExtensions"`
	HasMessages   bool             `json:"hasMessages"`
	HasServices   bool             `json:"hasServices"`
	Enums         []*Enum          `json:"enums"`
	Extensions    []*FileExtension `json:"extensions"`
	Messages      []*Message       `json:"messages"`
	Services      []*Service       `json:"services"`
	Options       Options          `json:"options,omitempty"`
}

File TODO

func (File) Option

func (f File) Option(name string) *ValidatorExtension

Option returns the named option.

type FileExtension

type FileExtension struct {
	File               *File  `json:"-"`
	Name               string `json:"name"`
	LongName           string `json:"longName"`
	FullName           string `json:"fullName"`
	Description        string `json:"description"`
	Label              string `json:"label"`
	Type               string `json:"type"`
	LongType           string `json:"longType"`
	FullType           string `json:"fullType"`
	Number             int    `json:"number"`
	DefaultValue       string `json:"defaultValue"`
	ContainingType     string `json:"containingType"`
	ContainingLongType string `json:"containingLongType"`
	ContainingFullType string `json:"containingFullType"`
}

FileExtension contains details about top-level extensions within a proto(2) file.

type Message

type Message struct {
	File          *File                  `json:"-"`
	Name          string                 `json:"name"`
	LongName      string                 `json:"longName"`
	FullName      string                 `json:"fullName"`
	Description   string                 `json:"description"`
	HasExtensions bool                   `json:"hasExtensions"`
	HasFields     bool                   `json:"hasFields"`
	HasOneofs     bool                   `json:"hasOneofs"`
	Extensions    []*MessageExtension    `json:"extensions"`
	Fields        []*MessageField        `json:"fields"`
	Options       Options                `json:"options,omitempty"`
	Ismapentry    bool                   `json:"-"`
	JSONObject    map[string]interface{} `json:"-"`
}

Message TODO

func (Message) FieldOptions

func (m Message) FieldOptions() []string

FieldOptions returns all options that are set on the fields in this message.

func (Message) FieldsWithOption

func (m Message) FieldsWithOption(optionName string) []*MessageField

FieldsWithOption returns all fields that have the given option set. If no single value has the option set, this returns nil.

func (Message) JSONString

func (m Message) JSONString(deep int) string

JSONString TODO

func (Message) Option

func (m Message) Option(name string) *ValidatorExtension

Option returns the named option.

type MessageExtension

type MessageExtension struct {
	FileExtension

	ScopeType     string `json:"scopeType"`
	ScopeLongType string `json:"scopeLongType"`
	ScopeFullType string `json:"scopeFullType"`
}

MessageExtension contains details about message-scoped extensions in proto(2) files.

type MessageField

type MessageField struct {
	Message      *Message `json:"-"`
	Name         string   `json:"name"`
	Description  string   `json:"description"`
	Label        string   `json:"label"`
	Type         string   `json:"type"`
	LongType     string   `json:"longType"`
	FullType     string   `json:"fullType"`
	Ismap        bool     `json:"ismap"`
	Isoneof      bool     `json:"isoneof"`
	Oneofdecl    string   `json:"oneofdecl"`
	DefaultValue string   `json:"defaultValue"`
	Options      Options  `json:"options,omitempty"`
	Done         bool     `json:"-"`
	Isarray      bool     `json:"-"`
	KeyType      string   `json:"-"`
	KeyLongType  string   `json:"-"`
	KeyFullType  string   `json:"-"`
}

MessageField TODO

func (MessageField) Option

func (f MessageField) Option(name string) *ValidatorExtension

Option returns the named option.

type Object

type Object struct {
	*Enum
	*Message
	*ScalarValue
	JSONObject interface{}
}

Object TODO

type Options

type Options map[string]*ValidatorExtension

Options TODO

func (*Options) UnmarshalJSON

func (o *Options) UnmarshalJSON(b []byte) error

UnmarshalJSON TODO

type Package

type Package struct {
	Name     string
	Services []*Service
}

Package TODO

type Renderer

type Renderer struct {
	ErrFile  *File
	Packages []*Package
	// contains filtered or unexported fields
}

Renderer TODO

func (*Renderer) Render

func (r *Renderer) Render(path string) error

Render TODO

type ScalarValue

type ScalarValue struct {
	ProtoType  string `json:"protoType"`
	Notes      string `json:"notes"`
	CppType    string `json:"cppType"`
	CSharp     string `json:"csType"`
	GoType     string `json:"goType"`
	JavaType   string `json:"javaType"`
	PhpType    string `json:"phpType"`
	PythonType string `json:"pythonType"`
	RubyType   string `json:"rubyType"`
}

ScalarValue contains information about scalar value types in protobuf. The common use case for this type is to know which language specific type maps to the protobuf type.

For example, the protobuf type `int64` maps to `long` in C#, and `Bignum` in Ruby. For the full list, take a look at https://developers.google.com/protocol-buffers/docs/proto3#scalar

type Service

type Service struct {
	File        *File            `json:"-"`
	Name        string           `json:"name"`
	LongName    string           `json:"longName"`
	FullName    string           `json:"fullName"`
	Description string           `json:"description"`
	Methods     []*ServiceMethod `json:"methods"`
	Options     Options          `json:"options,omitempty"`
}

Service TODO

func (Service) MethodOptions

func (s Service) MethodOptions() []string

MethodOptions returns all options that are set on the methods in this service.

func (Service) MethodsWithOption

func (s Service) MethodsWithOption(optionName string) []*ServiceMethod

MethodsWithOption returns all methods that have the given option set. If no single method has the option set, this returns nil.

func (Service) Option

func (s Service) Option(name string) *ValidatorExtension

Option returns the named option.

type ServiceMethod

type ServiceMethod struct {
	Service           *Service `json:"-"`
	Name              string   `json:"name"`
	Description       string   `json:"description"`
	RequestType       string   `json:"requestType"`
	RequestLongType   string   `json:"requestLongType"`
	RequestFullType   string   `json:"requestFullType"`
	RequestStreaming  bool     `json:"requestStreaming"`
	ResponseType      string   `json:"responseType"`
	ResponseLongType  string   `json:"responseLongType"`
	ResponseFullType  string   `json:"responseFullType"`
	ResponseStreaming bool     `json:"responseStreaming"`
	Options           Options  `json:"options,omitempty"`
}

ServiceMethod TODO

func (ServiceMethod) Option

func (m ServiceMethod) Option(name string) *ValidatorExtension

Option returns the named option.

type Template

type Template struct {
	Files   []*File        `json:"files"`
	Scalars []*ScalarValue `json:"scalarValueTypes"`
}

Template TODO

func (*Template) ParseFiles

func (tmpl *Template) ParseFiles(filenames ...string) error

ParseFiles TODO

type ValidatorExtension

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

ValidatorExtension TODO

func (ValidatorExtension) Rules

func (v ValidatorExtension) Rules() []ValidatorRule

Rules TODO

type ValidatorRule

type ValidatorRule struct {
	Name  string      `json:"name"`
	Value interface{} `json:"value"`
}

ValidatorRule TODO

Jump to

Keyboard shortcuts

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