ctx

package
v0.0.0-...-fc59d6d Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ResolveRules

func ResolveRules(desc protoreflect.FieldDescriptor, rules *v.FieldRules) (ruleType string, rule proto.Message, messageRule *v.MessageRules, wrapped bool)

Types

type FieldCtx

type FieldCtx struct {
	//MessageDesc protoreflect.MessageDescriptor
	Desc     protoreflect.FieldDescriptor
	Field    *protogen.Field
	Rules    proto.Message
	Pkg      string
	Name     string
	Type     string
	Index    int
	OnKey    string
	Required bool
	Skip     bool
	Wrap     string
	TmplName string
	Err      error
	Accessor string
	ErrCode  int32
}

func (*FieldCtx) Elem

func (fc *FieldCtx) Elem(def string) (elem FieldCtx, err error)

func (*FieldCtx) FullName

func (fc *FieldCtx) FullName() string

func (FieldCtx) GetAccessor

func (fc FieldCtx) GetAccessor() string

func (*FieldCtx) GetTmplName

func (fc *FieldCtx) GetTmplName() (string, error)

func (*FieldCtx) ImpCtx

func (fc *FieldCtx) ImpCtx() *ImportCtx

ImpCtx returns the import package name of the field

func (*FieldCtx) MapTypeName

func (fc *FieldCtx) MapTypeName(field *protogen.Field, desc protoreflect.FieldDescriptor, rule *v.FieldRules) *FieldCtx

func (*FieldCtx) SetAccessor

func (fc *FieldCtx) SetAccessor(def string) *FieldCtx

func (*FieldCtx) Unwrap

func (fc *FieldCtx) Unwrap(name string) (out FieldCtx, err error)

type ImportCtx

type ImportCtx struct {
	Alias string
	Path  string
}

type MessageCtx

type MessageCtx struct {
	Desc           protoreflect.MessageDescriptor
	TypeName       string
	Fields         []*FieldCtx
	Required       bool
	Disabled       bool
	Ignored        bool
	NonOneOfFields []*FieldCtx
	OptionalFields []*FieldCtx
	RealOneOfs     map[string]*OneOfField
	SubMessageCtxs []*MessageCtx
}

type NeedWellKnown

type NeedWellKnown struct {
	Email    bool
	Hostname bool
	UUID     bool
}

type OneOfField

type OneOfField struct {
	Field  *protogen.Field
	Fields []*FieldCtx
	Name   string
	Type   string
	//Index    int
	Required bool
	Skip     bool
}

type ValidateCtx

type ValidateCtx struct {
	Imports      []*ImportCtx
	Messages     []*MessageCtx
	NeedWellKnow *NeedWellKnown
	NeedCommon   bool
	ErrCodeBegin int32
}

Jump to

Keyboard shortcuts

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