gojson

package
v0.0.0-...-5b10fbc Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New() pkgenerator.Plugin

Types

type FieldBuilder

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

FieldBuilder for load the proto field into the fieldSet.

func (*FieldBuilder) Build

func (x *FieldBuilder) Build(file *protogen.File, msg *protogen.Message) []*FieldSet

type FieldSet

type FieldSet struct {
	// Field represents the origin object in the protogen.
	Field *protogen.Field

	// Options represents the Options for field.
	Options *pbjson.FieldOptions

	// JSONKey represents the keyword in JSON format.
	JSONKey string

	// And the value is not nil means the field type if oneof.
	OneOfSet *OneOfSet

	// IsOneOfPart represents whether the field is part member in an oneof field.
	IsOneOfPart bool

	// InlineSet the value is not nil means the field is inline.
	InlineSet *InlineSet

	// Parent represents the field to which the inline message belongs or the oneof field for oneof part.
	Parent *FieldSet

	// Level is the level of the message to which the field belongs.
	Level int

	// Number is the unique number for this field.
	Number int64
}

func (*FieldSet) Alias

func (x *FieldSet) Alias() string

Alias represents the variable name of the field alias.

func (*FieldSet) FieldIsInline

func (x *FieldSet) FieldIsInline() bool

FieldIsInline indicates whether directly expanded in current ares.

func (*FieldSet) GoName

func (x *FieldSet) GoName() string

func (*FieldSet) ID

func (x *FieldSet) ID() string

func (*FieldSet) IsOneOfField

func (x *FieldSet) IsOneOfField() bool

IsOneOfField return the field whether is oneof.

func (*FieldSet) OneOfField

func (x *FieldSet) OneOfField() *FieldSet

func (*FieldSet) OneOfIsInline

func (x *FieldSet) OneOfIsInline() bool

func (*FieldSet) ParentField

func (x *FieldSet) ParentField() *FieldSet

func (*FieldSet) Value

func (x *FieldSet) Value() string

Value represents the variable name of the field value.

type IdGenerator

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

IdGenerator for generate a unique id for every field.

func (*IdGenerator) Take

func (x *IdGenerator) Take() int64

type InlineSet

type InlineSet struct {
	// Childs represents the list of fields which inline to the message.
	Childs []*FieldSet
}

type Marshal

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

func (*Marshal) GenerateCode

func (ml *Marshal) GenerateCode(fieldSets []*FieldSet)

type OneOfSet

type OneOfSet struct {
	// Options represents the Options for oneof.
	Options *pbjson.OneofOptions

	// Parts represents the list of fields which location in the oneof field.
	Parts []*FieldSet
}

type Plugin

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

Plugin for implements pgkgenerator.Plugin

func (*Plugin) Generate

func (p *Plugin) Generate(g *protogen.GeneratedFile)

Generate to generate codes for specified file. except for the imports, by calling the generator's methods P, In, and Out.

func (*Plugin) Init

func (p *Plugin) Init(pp *protogen.Plugin, file *protogen.File) bool

Init is called once before code generated. The `file` will be ignored if return false.

func (*Plugin) Name

func (p *Plugin) Name() string

Name identifies the Plugin.

func (*Plugin) ParamFunc

func (p *Plugin) ParamFunc() func(name, value string) error

ParamFunc is used for accept parameters from the command line.

func (*Plugin) Version

func (p *Plugin) Version() string

Version identifies the Plugin version.

type Unmarshal

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

func (*Unmarshal) GenerateCode

func (ul *Unmarshal) GenerateCode(fieldSets []*FieldSet)

Directories

Path Synopsis
pkg

Jump to

Keyboard shortcuts

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