plugin

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsTypeLong

func IsTypeLong(field protoreflect.FieldDescriptor) bool

func IsWellKnownType

func IsWellKnownType(desc protoreflect.Descriptor) bool

func IsWellKnownTypeLong

func IsWellKnownTypeLong(wkt WellKnown) bool

Check is WellKnownInt64Value or WellKnownUInt64Value type.

func TextToCase

func TextToCase(text, textcase string) string

Types

type Options

type Options struct {
	// UseProtoNames controls the casing of generated field names.
	// If set to true, fields will use proto names (typically snake_case).
	// If omitted or set to false, fields will use JSON names (typically camelCase).
	UseProtoNames bool
	// UseEnumNumbers emits enum values as numbers.
	UseEnumNumbers bool
	// The method names of service methods naming case.
	// Only work when `UseEnumNumbers=true`
	// opt:
	// camelcase: convert name to lower camel case like `camelCase`
	// pascalcase: convert name to pascalcase like `PascalCase`
	// default is pascalcase
	EnumFieldNaming string
	// Generate comments as multiline comments.
	UseMultiLineComment bool
	// force add `undefined` to message field.
	// default true
	ForceMessageFieldUndefinable bool
	// If set to true, body will be JSON.stringify before send
	// default true
	UseBodyStringify bool
	// The method names of service methods naming case.
	// opt:
	// camelcase: convert name to lower camel case like `camelCase`
	// pascalcase: convert name to pascalcase like `PascalCase`
	// default is pascalcase
	ServiceMethodNaming string
	// If set to true, field int64 and uint64 will convert to string
	ForceLongAsString bool
}

type Type

type Type struct {
	IsNamed bool
	Name    string

	IsList     bool
	IsMap      bool
	Underlying *Type
}

func (Type) Reference

func (t Type) Reference() string

type WellKnown

type WellKnown string
const (
	WellKnownAny       WellKnown = "google.protobuf.Any"
	WellKnownDuration  WellKnown = "google.protobuf.Duration"
	WellKnownEmpty     WellKnown = "google.protobuf.Empty"
	WellKnownFieldMask WellKnown = "google.protobuf.FieldMask"
	WellKnownStruct    WellKnown = "google.protobuf.Struct"
	WellKnownTimestamp WellKnown = "google.protobuf.Timestamp"

	// Wrapper types.
	WellKnownFloatValue  WellKnown = "google.protobuf.FloatValue"
	WellKnownInt64Value  WellKnown = "google.protobuf.Int64Value"
	WellKnownInt32Value  WellKnown = "google.protobuf.Int32Value"
	WellKnownUInt64Value WellKnown = "google.protobuf.UInt64Value"
	WellKnownUInt32Value WellKnown = "google.protobuf.UInt32Value"
	WellKnownBytesValue  WellKnown = "google.protobuf.BytesValue"
	WellKnownDoubleValue WellKnown = "google.protobuf.DoubleValue"
	WellKnownBoolValue   WellKnown = "google.protobuf.BoolValue"
	WellKnownStringValue WellKnown = "google.protobuf.StringValue"

	// Descriptor types.
	WellKnownValue     WellKnown = "google.protobuf.Value"
	WellKnownNullValue WellKnown = "google.protobuf.NullValue"
	WellKnownListValue WellKnown = "google.protobuf.ListValue"
)

https://developers.google.com/protocol-buffers/docs/reference/google.protobuf

func WellKnownType

func WellKnownType(desc protoreflect.Descriptor) (WellKnown, bool)

func (WellKnown) Name

func (wkt WellKnown) Name() string

func (WellKnown) TypeDeclaration

func (wkt WellKnown) TypeDeclaration() string

Jump to

Keyboard shortcuts

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