Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Boolean = &GenericType{ slug: "boolean", cat: typecategory.Basic, kinds: []string{ reflect.Bool.String(), }, }
Basic types.
var DateTime = &GenericType{ slug: "datetime", cat: typecategory.Known, kinds: []string{ "time.Time", }, }
var Float = &GenericType{ slug: "float", cat: typecategory.Basic, kinds: []string{ reflect.Float32.String(), reflect.Float64.String(), }, }
var Integer = &GenericType{ slug: "integer", cat: typecategory.Basic, kinds: []string{ reflect.Int.String(), reflect.Int8.String(), reflect.Int16.String(), reflect.Int32.String(), reflect.Int64.String(), reflect.Uint.String(), reflect.Uint8.String(), reflect.Uint16.String(), reflect.Uint32.String(), reflect.Uint64.String(), reflect.Uintptr.String(), }, }
var Interface = &GenericType{ slug: "interface", pathDefault: "{?}", cat: typecategory.Reference, kinds: []string{ reflect.Interface.String(), }, }
Reference types.
var Invalid = &GenericType{ slug: "invalid", cat: typecategory.Invalid, kinds: []string{ reflect.Invalid.String(), reflect.Complex64.String(), reflect.Complex128.String(), reflect.Chan.String(), reflect.Func.String(), reflect.UnsafePointer.String(), }, }
Invalid types are not allowed in shiny schemas.
var List = &GenericType{ slug: "list", pathDefault: "[]", cat: typecategory.Compound, kinds: []string{ reflect.Array.String(), reflect.Slice.String(), }, }
Compound types.
var Map = &GenericType{ slug: "map", pathDefault: "map{}", cat: typecategory.Compound, kinds: []string{ reflect.Map.String(), }, }
var Pointer = &GenericType{ slug: "pointer", pathDefault: "*", cat: typecategory.Reference, kinds: []string{ reflect.Ptr.String(), }, }
var Root = &GenericType{ slug: "root", pathDefault: "$", cat: typecategory.Internal, kinds: []string{}, }
Root is at the top of any type tree.
var String = &GenericType{ slug: "string", cat: typecategory.Basic, kinds: []string{ reflect.String.String(), }, }
var Struct = &GenericType{ slug: "struct", pathDefault: "{}", cat: typecategory.Compound, kinds: []string{ reflect.Struct.String(), }, }
Functions ¶
func FullPathOf ¶ added in v0.0.11
FullPathOf returns the full package path for a Value.
func PathDefaultOfType ¶
PathDefaultOfType returns the path default for a given generic type string.
Types ¶
type GenericType ¶
type GenericType struct {
// contains filtered or unexported fields
}
GenericType defines generic types for shiny schemas. Uses slugs from: https://threedots.tech/post/safer-enums-in-go/
func GenericTypeOf ¶
func GenericTypeOf(v reflect.Value) *GenericType
GenericTypeOf returns the GenericType of the given reflect.Value.
func (*GenericType) Category ¶
func (t *GenericType) Category() typecategory.TypeCategory
Category returns the TypeCategory for the GenericType.
func (*GenericType) ContainsKind ¶ added in v0.0.11
func (t *GenericType) ContainsKind(kind string) bool
ContainsKind returns true if the generic type contains the kind string.
func (*GenericType) PathDefault ¶
func (t *GenericType) PathDefault() string
PathDefault returns the default path string for the GenericType.
func (*GenericType) String ¶
func (t *GenericType) String() string
String returns GenericType as a string.