Documentation ¶
Index ¶
- func Ptr[T any](val T) *T
- func ScalarSchemaFromProto(src protoreflect.FieldDescriptor) (schema_j5pb.IsField_Type, bool, error)
- func WalkSchemaFields(root RootSchema, asClient bool, callback WalkCallback) error
- type AnyField
- type ArrayField
- type Container
- type ContainerSchema
- type EnumField
- func (s *EnumField) AsContainer() (Container, bool)
- func (f *EnumField) FullName() string
- func (s *EnumField) Mutable() bool
- func (f *EnumField) ParentContext() (ContainerSchema, string)
- func (s *EnumField) Schema() *EnumSchema
- func (s *EnumField) ToJ5Field() *schema_j5pb.Field
- func (s *EnumField) TypeName() string
- type EnumOption
- type EnumSchema
- func (s *EnumSchema) AsRef() *RefSchema
- func (s *EnumSchema) Description() string
- func (s *EnumSchema) FullName() string
- func (s *EnumSchema) Name() string
- func (s *EnumSchema) OptionByName(name string) *EnumOption
- func (s *EnumSchema) OptionByNumber(num int32) *EnumOption
- func (s *EnumSchema) OptionsList() []string
- func (s *EnumSchema) Package() *Package
- func (s *EnumSchema) PackageName() string
- func (s *EnumSchema) ToJ5ClientRoot() *schema_j5pb.RootSchema
- func (s *EnumSchema) ToJ5Root() *schema_j5pb.RootSchema
- type FieldSchema
- type MapField
- type ObjectField
- func (s *ObjectField) AsContainer() (Container, bool)
- func (f *ObjectField) FullName() string
- func (s *ObjectField) Mutable() bool
- func (f *ObjectField) ParentContext() (ContainerSchema, string)
- func (s *ObjectField) Schema() *ObjectSchema
- func (s *ObjectField) ToJ5Field() *schema_j5pb.Field
- func (s *ObjectField) TypeName() string
- type ObjectProperty
- type ObjectSchema
- func (s *ObjectSchema) AsRef() *RefSchema
- func (s *ObjectSchema) ClientProperties() []*ObjectProperty
- func (s *ObjectSchema) Clone() *ObjectSchema
- func (s *ObjectSchema) Description() string
- func (s *ObjectSchema) FullName() string
- func (s *ObjectSchema) Name() string
- func (s *ObjectSchema) Package() *Package
- func (s *ObjectSchema) PackageName() string
- func (s *ObjectSchema) ToJ5ClientObject() *schema_j5pb.Object
- func (s *ObjectSchema) ToJ5ClientRoot() *schema_j5pb.RootSchema
- func (s *ObjectSchema) ToJ5Object() *schema_j5pb.Object
- func (s *ObjectSchema) ToJ5Root() *schema_j5pb.RootSchema
- type OneofField
- func (s *OneofField) AsContainer() (Container, bool)
- func (f *OneofField) FullName() string
- func (s *OneofField) Mutable() bool
- func (f *OneofField) ParentContext() (ContainerSchema, string)
- func (s *OneofField) Schema() *OneofSchema
- func (s *OneofField) ToJ5Field() *schema_j5pb.Field
- func (s *OneofField) TypeName() string
- type OneofSchema
- func (s *OneofSchema) AsRef() *RefSchema
- func (s *OneofSchema) ClientProperties() []*ObjectProperty
- func (s *OneofSchema) Description() string
- func (s *OneofSchema) FullName() string
- func (s *OneofSchema) Name() string
- func (s *OneofSchema) Package() *Package
- func (s *OneofSchema) PackageName() string
- func (s *OneofSchema) ToJ5ClientRoot() *schema_j5pb.RootSchema
- func (s *OneofSchema) ToJ5Root() *schema_j5pb.RootSchema
- type Package
- type PropertySet
- type RefSchema
- type RootSchema
- type RootSet
- type ScalarSchema
- type SchemaCache
- type SchemaSet
- type WalkCallback
- type WalkProperty
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ScalarSchemaFromProto ¶
func ScalarSchemaFromProto(src protoreflect.FieldDescriptor) (schema_j5pb.IsField_Type, bool, error)
func WalkSchemaFields ¶
func WalkSchemaFields(root RootSchema, asClient bool, callback WalkCallback) error
Types ¶
type AnyField ¶
type AnyField struct { OnlyDefined bool Types []protoreflect.FullName // contains filtered or unexported fields }
func (*AnyField) AsContainer ¶
func (*AnyField) ParentContext ¶
func (f *AnyField) ParentContext() (ContainerSchema, string)
func (*AnyField) ToJ5Field ¶
func (s *AnyField) ToJ5Field() *schema_j5pb.Field
type ArrayField ¶
type ArrayField struct { Schema FieldSchema Rules *schema_j5pb.ArrayField_Rules Ext *schema_j5pb.ArrayField_Ext // contains filtered or unexported fields }
func (*ArrayField) AsContainer ¶
func (s *ArrayField) AsContainer() (Container, bool)
func (*ArrayField) Mutable ¶
func (s *ArrayField) Mutable() bool
func (*ArrayField) ParentContext ¶
func (f *ArrayField) ParentContext() (ContainerSchema, string)
func (*ArrayField) ToJ5Field ¶
func (s *ArrayField) ToJ5Field() *schema_j5pb.Field
func (*ArrayField) TypeName ¶
func (s *ArrayField) TypeName() string
type Container ¶
type Container interface { PropertyField(name string) FieldSchema WalkToProperty(name ...string) (FieldSchema, error) }
type ContainerSchema ¶
type ContainerSchema interface {
FullName() string
}
type EnumField ¶
type EnumField struct { Ref *RefSchema Rules *schema_j5pb.EnumField_Rules ListRules *list_j5pb.EnumRules Ext *schema_j5pb.EnumField_Ext // contains filtered or unexported fields }
func (*EnumField) AsContainer ¶
func (*EnumField) ParentContext ¶
func (f *EnumField) ParentContext() (ContainerSchema, string)
func (*EnumField) Schema ¶
func (s *EnumField) Schema() *EnumSchema
func (*EnumField) ToJ5Field ¶
func (s *EnumField) ToJ5Field() *schema_j5pb.Field
type EnumOption ¶
func (*EnumOption) Description ¶
func (eo *EnumOption) Description() string
func (*EnumOption) Name ¶
func (eo *EnumOption) Name() string
func (*EnumOption) Number ¶
func (eo *EnumOption) Number() int32
func (*EnumOption) ToJ5EnumValue ¶
func (eo *EnumOption) ToJ5EnumValue() *schema_j5pb.Enum_Option
type EnumSchema ¶
type EnumSchema struct { NamePrefix string Options []*EnumOption //schema_j5pb.Enum_Value InfoFields []*schema_j5pb.Enum_OptionInfoField // contains filtered or unexported fields }
func (*EnumSchema) Description ¶
func (s *EnumSchema) Description() string
func (*EnumSchema) OptionByName ¶
func (s *EnumSchema) OptionByName(name string) *EnumOption
func (*EnumSchema) OptionByNumber ¶
func (s *EnumSchema) OptionByNumber(num int32) *EnumOption
func (*EnumSchema) OptionsList ¶
func (s *EnumSchema) OptionsList() []string
func (*EnumSchema) PackageName ¶
func (s *EnumSchema) PackageName() string
func (*EnumSchema) ToJ5ClientRoot ¶
func (s *EnumSchema) ToJ5ClientRoot() *schema_j5pb.RootSchema
func (*EnumSchema) ToJ5Root ¶
func (s *EnumSchema) ToJ5Root() *schema_j5pb.RootSchema
type FieldSchema ¶
type FieldSchema interface { ToJ5Field() *schema_j5pb.Field TypeName() string ParentContext() (ContainerSchema, string) FullName() string // Mutable determines how reflection can access the Field // true for ObjectField and OneofField // false for ScalarField, EnumField // true for ArrayField and MapField // false for AnyField special case Mutable() bool AsContainer() (Container, bool) }
type MapField ¶
type MapField struct { Schema FieldSchema Rules *schema_j5pb.MapField_Rules Ext *schema_j5pb.MapField_Ext // contains filtered or unexported fields }
func (*MapField) AsContainer ¶
func (*MapField) ParentContext ¶
func (f *MapField) ParentContext() (ContainerSchema, string)
func (*MapField) ToJ5Field ¶
func (s *MapField) ToJ5Field() *schema_j5pb.Field
type ObjectField ¶
type ObjectField struct { Ref *RefSchema Flatten bool Rules *schema_j5pb.ObjectField_Rules Ext *schema_j5pb.ObjectField_Ext // contains filtered or unexported fields }
func (*ObjectField) AsContainer ¶
func (s *ObjectField) AsContainer() (Container, bool)
func (*ObjectField) Mutable ¶
func (s *ObjectField) Mutable() bool
func (*ObjectField) ParentContext ¶
func (f *ObjectField) ParentContext() (ContainerSchema, string)
func (*ObjectField) Schema ¶
func (s *ObjectField) Schema() *ObjectSchema
func (*ObjectField) ToJ5Field ¶
func (s *ObjectField) ToJ5Field() *schema_j5pb.Field
func (*ObjectField) TypeName ¶
func (s *ObjectField) TypeName() string
type ObjectProperty ¶
type ObjectProperty struct { Parent RootSchema Schema FieldSchema ProtoField []protoreflect.FieldNumber JSONName string Required bool ReadOnly bool WriteOnly bool ExplicitlyOptional bool Description string }
func (*ObjectProperty) FullName ¶
func (prop *ObjectProperty) FullName() string
func (*ObjectProperty) ToJ5Proto ¶
func (prop *ObjectProperty) ToJ5Proto() *schema_j5pb.ObjectProperty
type ObjectSchema ¶
type ObjectSchema struct { Entity *schema_j5pb.EntityObject AnyMember []string Properties PropertySet // contains filtered or unexported fields }
func (*ObjectSchema) ClientProperties ¶
func (s *ObjectSchema) ClientProperties() []*ObjectProperty
func (*ObjectSchema) Clone ¶
func (s *ObjectSchema) Clone() *ObjectSchema
func (*ObjectSchema) Description ¶
func (s *ObjectSchema) Description() string
func (*ObjectSchema) PackageName ¶
func (s *ObjectSchema) PackageName() string
func (*ObjectSchema) ToJ5ClientObject ¶
func (s *ObjectSchema) ToJ5ClientObject() *schema_j5pb.Object
func (*ObjectSchema) ToJ5ClientRoot ¶
func (s *ObjectSchema) ToJ5ClientRoot() *schema_j5pb.RootSchema
func (*ObjectSchema) ToJ5Object ¶
func (s *ObjectSchema) ToJ5Object() *schema_j5pb.Object
func (*ObjectSchema) ToJ5Root ¶
func (s *ObjectSchema) ToJ5Root() *schema_j5pb.RootSchema
type OneofField ¶
type OneofField struct { Ref *RefSchema Rules *schema_j5pb.OneofField_Rules ListRules *list_j5pb.OneofRules Ext *schema_j5pb.OneofField_Ext // contains filtered or unexported fields }
func (*OneofField) AsContainer ¶
func (s *OneofField) AsContainer() (Container, bool)
func (*OneofField) Mutable ¶
func (s *OneofField) Mutable() bool
func (*OneofField) ParentContext ¶
func (f *OneofField) ParentContext() (ContainerSchema, string)
func (*OneofField) Schema ¶
func (s *OneofField) Schema() *OneofSchema
func (*OneofField) ToJ5Field ¶
func (s *OneofField) ToJ5Field() *schema_j5pb.Field
func (*OneofField) TypeName ¶
func (s *OneofField) TypeName() string
type OneofSchema ¶
type OneofSchema struct { Properties PropertySet // contains filtered or unexported fields }
func (*OneofSchema) ClientProperties ¶
func (s *OneofSchema) ClientProperties() []*ObjectProperty
func (*OneofSchema) Description ¶
func (s *OneofSchema) Description() string
func (*OneofSchema) PackageName ¶
func (s *OneofSchema) PackageName() string
func (*OneofSchema) ToJ5ClientRoot ¶
func (s *OneofSchema) ToJ5ClientRoot() *schema_j5pb.RootSchema
func (*OneofSchema) ToJ5Root ¶
func (s *OneofSchema) ToJ5Root() *schema_j5pb.RootSchema
type PropertySet ¶
type PropertySet []*ObjectProperty
func (PropertySet) ByJSONName ¶
func (ps PropertySet) ByJSONName(name string) *ObjectProperty
func (PropertySet) PropertyField ¶
func (ps PropertySet) PropertyField(name string) FieldSchema
func (PropertySet) WalkToProperty ¶
func (ps PropertySet) WalkToProperty(name ...string) (FieldSchema, error)
type RefSchema ¶
type RefSchema struct { Package *Package Schema string To RootSchema }
type RootSchema ¶
type RootSchema interface { AsRef() *RefSchema FullName() string Name() string PackageName() string Package() *Package ToJ5Root() *schema_j5pb.RootSchema ToJ5ClientRoot() *schema_j5pb.RootSchema Description() string }
type ScalarSchema ¶
type ScalarSchema struct { // subset of the available schema types, everything excluding ref, oneof // wrapper, array, object, map Proto *schema_j5pb.Field Kind protoreflect.Kind WellKnownTypeName protoreflect.FullName // contains filtered or unexported fields }
func (*ScalarSchema) AsContainer ¶
func (s *ScalarSchema) AsContainer() (Container, bool)
func (*ScalarSchema) Mutable ¶
func (s *ScalarSchema) Mutable() bool
func (*ScalarSchema) ParentContext ¶
func (f *ScalarSchema) ParentContext() (ContainerSchema, string)
func (*ScalarSchema) ToJ5Field ¶
func (s *ScalarSchema) ToJ5Field() *schema_j5pb.Field
func (*ScalarSchema) TypeName ¶
func (s *ScalarSchema) TypeName() string
type SchemaCache ¶
type SchemaCache struct {
// contains filtered or unexported fields
}
SchemaCache acts like PackageSet, but builds schemas on demand from reflection.
func NewSchemaCache ¶
func NewSchemaCache() *SchemaCache
func (*SchemaCache) Schema ¶
func (sc *SchemaCache) Schema(src protoreflect.MessageDescriptor) (RootSchema, error)
Schema returns the J5 schema for the given message descriptor.
type SchemaSet ¶
func PackageSetFromSourceAPI ¶
func PackageSetFromSourceAPI(packages []*source_j5pb.Package) (*SchemaSet, error)
func SchemaSetFromFiles ¶
func SchemaSetFromFiles(descFiles *protoregistry.Files, include func(protoreflect.FileDescriptor) bool) (*SchemaSet, error)
func (*SchemaSet) AnonymousObjectFromSchema ¶
func (ps *SchemaSet) AnonymousObjectFromSchema(packageName string, schema *schema_j5pb.Object) (*ObjectSchema, error)
AnonymousObjectFromSchema converts the schema object but does not add it to the package set. This is used for dynamic request and reply entities.
func (*SchemaSet) SchemaByName ¶
func (ss *SchemaSet) SchemaByName(packageName, name string) (RootSchema, error)
type WalkCallback ¶
type WalkCallback func(schema WalkProperty) error
type WalkProperty ¶
type WalkProperty struct { *ObjectProperty Path []string }
Click to show internal directories.
Click to hide internal directories.