beam: Index | Files

package schema

import ""

Package schema contains utility functions for relating Go types and Beam Schemas.

Not all Go types can be converted to schemas. This is Go is more expressive than Beam schemas. Just as not all Go types can be serialized, similarly, not all Beam Schemas will have a conversion to Go types, until the correct mechanism exists in the SDK to handle them.

While efforts will be made to have conversions be reversable, this will not be possible in all instances. Eg. Go arrays as fields will be converted to Beam Arrays, but a Beam Array type will map by default to a Go slice.


Package Files


func FromType Uses

func FromType(ot reflect.Type) (*pipepb.Schema, error)

FromType returns a Beam Schema of the passed in type. Returns an error if the type cannot be converted to a Schema.

func RegisterType Uses

func RegisterType(ut reflect.Type)

RegisterType converts the type to it's schema representation, and converts it back to a synthetic type so we can map from the synthetic type back to the user type. Recursively registers other named struct types in any component parts.

func Registered Uses

func Registered(ut reflect.Type) bool

Registered returns whether the given type has been registered with the schema package.

func ToType Uses

func ToType(s *pipepb.Schema) (reflect.Type, error)

ToType returns a Go type of the passed in Schema. Types returned by ToType are always of Struct kind. Returns an error if the Schema cannot be converted to a type.

Package schema imports 9 packages (graph) and is imported by 1 packages. Updated 2020-08-18. Refresh now. Tools for package owners.