pbjson

package
v0.0.0-...-c713541 Latest Latest
Warning

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

Go to latest
Published: May 28, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NameStyle_name = map[int32]string{
		0: "NameStyleUnset",
		1: "TextName",
		2: "GoName",
		3: "JSONName",
	}
	NameStyle_value = map[string]int32{
		"NameStyleUnset": 0,
		"TextName":       1,
		"GoName":         2,
		"JSONName":       3,
	}
)

Enum value maps for NameStyle.

View Source
var (
	// Whether use string format for enum type. default use integer.
	//
	// optional json.EnumOptions enum = 8001;
	E_Enum = &file_json_proto_extTypes[4]
)

Extension fields to descriptorpb.EnumOptions.

View Source
var (
	// optional json.FieldOptions field = 6001;
	E_Field = &file_json_proto_extTypes[2]
)

Extension fields to descriptorpb.FieldOptions.

View Source
var (
	// optional json.SerializeOptions file = 4001;
	E_File = &file_json_proto_extTypes[0]
)

Extension fields to descriptorpb.FileOptions.

View Source
var (
	// optional json.SerializeOptions message = 5001;
	E_Message = &file_json_proto_extTypes[1]
)

Extension fields to descriptorpb.MessageOptions.

View Source
var (
	// optional json.OneofOptions oneof = 7001;
	E_Oneof = &file_json_proto_extTypes[3]
)

Extension fields to descriptorpb.OneofOptions.

Functions

This section is empty.

Types

type EnumOptions

type EnumOptions struct {

	// Whether use string format for enum type. default use integer.
	UseEnumString *bool `protobuf:"varint,1,opt,name=use_enum_string,json=useEnumString,proto3,oneof" json:"use_enum_string,omitempty"`
	// contains filtered or unexported fields
}

func (*EnumOptions) Descriptor deprecated

func (*EnumOptions) Descriptor() ([]byte, []int)

Deprecated: Use EnumOptions.ProtoReflect.Descriptor instead.

func (*EnumOptions) GetUseEnumString

func (x *EnumOptions) GetUseEnumString() bool

func (*EnumOptions) ProtoMessage

func (*EnumOptions) ProtoMessage()

func (*EnumOptions) ProtoReflect

func (x *EnumOptions) ProtoReflect() protoreflect.Message

func (*EnumOptions) Reset

func (x *EnumOptions) Reset()

func (*EnumOptions) String

func (x *EnumOptions) String() string

type FieldOptions

type FieldOptions struct {

	// The key name in json format.
	// if "json" is "-", The field will be ignore.
	Json *string `protobuf:"bytes,1,opt,name=json,proto3,oneof" json:"json,omitempty"`
	// If true, the field will be ignore. It same as `json: "-"`
	Ignore *bool `protobuf:"varint,2,opt,name=ignore,proto3,oneof" json:"ignore,omitempty"`
	// Whether omit the field of empty value in encoding(MarshalJSON).
	// It same as the struct tag `json:"xxx,omitempty"`.
	Omitempty *bool `protobuf:"varint,3,opt,name=omitempty,proto3,oneof" json:"omitempty,omitempty"`
	// Whether use string format for enum type. default use integer.
	UseEnumString *bool `protobuf:"varint,4,opt,name=use_enum_string,json=useEnumString,proto3,oneof" json:"use_enum_string,omitempty"`
	// contains filtered or unexported fields
}

func (*FieldOptions) Descriptor deprecated

func (*FieldOptions) Descriptor() ([]byte, []int)

Deprecated: Use FieldOptions.ProtoReflect.Descriptor instead.

func (*FieldOptions) GetIgnore

func (x *FieldOptions) GetIgnore() bool

func (*FieldOptions) GetJson

func (x *FieldOptions) GetJson() string

func (*FieldOptions) GetOmitempty

func (x *FieldOptions) GetOmitempty() bool

func (*FieldOptions) GetUseEnumString

func (x *FieldOptions) GetUseEnumString() bool

func (*FieldOptions) ProtoMessage

func (*FieldOptions) ProtoMessage()

func (*FieldOptions) ProtoReflect

func (x *FieldOptions) ProtoReflect() protoreflect.Message

func (*FieldOptions) Reset

func (x *FieldOptions) Reset()

func (*FieldOptions) String

func (x *FieldOptions) String() string

type NameStyle

type NameStyle int32
const (
	NameStyle_NameStyleUnset NameStyle = 0
	NameStyle_TextName       NameStyle = 1 // Protobuf's text name (field.Desc.TextName()). This is default.
	NameStyle_GoName         NameStyle = 2 // The golang's field name. It is upper camel case.
	NameStyle_JSONName       NameStyle = 3 // Protobuf's json name (field.Desc.JSONName()). It is lower camel case.
)

func (NameStyle) Descriptor

func (NameStyle) Descriptor() protoreflect.EnumDescriptor

func (NameStyle) Enum

func (x NameStyle) Enum() *NameStyle

func (NameStyle) EnumDescriptor deprecated

func (NameStyle) EnumDescriptor() ([]byte, []int)

Deprecated: Use NameStyle.Descriptor instead.

func (NameStyle) Number

func (x NameStyle) Number() protoreflect.EnumNumber

func (NameStyle) String

func (x NameStyle) String() string

func (NameStyle) Type

type OneofOptions

type OneofOptions struct {

	// The key name in json format. Default is field's name of golang.
	// if "json" is "-", The field will be ignore.
	Json *string `protobuf:"bytes,1,opt,name=json,proto3,oneof" json:"json,omitempty"`
	// If true, the field will be ignore. It same as `json: "-"`
	Ignore *bool `protobuf:"varint,2,opt,name=ignore,proto3,oneof" json:"ignore,omitempty"`
	// Whether omit the field of empty value in encoding(MarshalJSON).
	// It same as the struct tag `json:"xxx,omitempty"`.
	Omitempty *bool `protobuf:"varint,3,opt,name=omitempty,proto3,oneof" json:"omitempty,omitempty"`
	// Whether hide the key of oneof in json format.
	HideOneofKey *bool `protobuf:"varint,4,opt,name=hide_oneof_key,json=hideOneofKey,proto3,oneof" json:"hide_oneof_key,omitempty"`
	// contains filtered or unexported fields
}

func (*OneofOptions) Descriptor deprecated

func (*OneofOptions) Descriptor() ([]byte, []int)

Deprecated: Use OneofOptions.ProtoReflect.Descriptor instead.

func (*OneofOptions) GetHideOneofKey

func (x *OneofOptions) GetHideOneofKey() bool

func (*OneofOptions) GetIgnore

func (x *OneofOptions) GetIgnore() bool

func (*OneofOptions) GetJson

func (x *OneofOptions) GetJson() string

func (*OneofOptions) GetOmitempty

func (x *OneofOptions) GetOmitempty() bool

func (*OneofOptions) ProtoMessage

func (*OneofOptions) ProtoMessage()

func (*OneofOptions) ProtoReflect

func (x *OneofOptions) ProtoReflect() protoreflect.Message

func (*OneofOptions) Reset

func (x *OneofOptions) Reset()

func (*OneofOptions) String

func (x *OneofOptions) String() string

type SerializeOptions

type SerializeOptions struct {

	// name_style represents the key name in json format.
	NameStyle *NameStyle `protobuf:"varint,1,opt,name=name_style,json=nameStyle,proto3,enum=json.NameStyle,oneof" json:"name_style,omitempty"`
	// Whether ignore generating code for the file or message.
	Ignore *bool `protobuf:"varint,2,opt,name=ignore,proto3,oneof" json:"ignore,omitempty"`
	// Whether use string format for enum type field. default use integer.
	UseEnumString *bool `protobuf:"varint,3,opt,name=use_enum_string,json=useEnumString,proto3,oneof" json:"use_enum_string,omitempty"`
	// Whether hide the key of oneof in json format.
	HideOneofKey *bool `protobuf:"varint,4,opt,name=hide_oneof_key,json=hideOneofKey,proto3,oneof" json:"hide_oneof_key,omitempty"`
	// Whether omit the field of empty value in encoding(MarshalJSON).
	// It same as the struct tag `json:"xxx,omitempty"`.
	Omitempty *bool `protobuf:"varint,5,opt,name=omitempty,proto3,oneof" json:"omitempty,omitempty"`
	// disallow_unknown_fields causes the Decoder to return an error when the destination
	// is a struct and the input contains object keys which do not match any
	// non-ignored, exported fields in the destination.
	DisallowUnknownFields *bool `` /* 133-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*SerializeOptions) Descriptor deprecated

func (*SerializeOptions) Descriptor() ([]byte, []int)

Deprecated: Use SerializeOptions.ProtoReflect.Descriptor instead.

func (*SerializeOptions) GetDisallowUnknownFields

func (x *SerializeOptions) GetDisallowUnknownFields() bool

func (*SerializeOptions) GetHideOneofKey

func (x *SerializeOptions) GetHideOneofKey() bool

func (*SerializeOptions) GetIgnore

func (x *SerializeOptions) GetIgnore() bool

func (*SerializeOptions) GetNameStyle

func (x *SerializeOptions) GetNameStyle() NameStyle

func (*SerializeOptions) GetOmitempty

func (x *SerializeOptions) GetOmitempty() bool

func (*SerializeOptions) GetUseEnumString

func (x *SerializeOptions) GetUseEnumString() bool

func (*SerializeOptions) ProtoMessage

func (*SerializeOptions) ProtoMessage()

func (*SerializeOptions) ProtoReflect

func (x *SerializeOptions) ProtoReflect() protoreflect.Message

func (*SerializeOptions) Reset

func (x *SerializeOptions) Reset()

func (*SerializeOptions) String

func (x *SerializeOptions) String() string

Jump to

Keyboard shortcuts

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