Documentation ¶
Overview ¶
Package reflect provides [rapid.Generator]s for reflect types.
Index ¶
- type GenerateType
- func Array(maxDepth int) GenerateType
- func ArrayOf(typ GenerateType) GenerateType
- func Bool() GenerateType
- func Map(maxDepth int) GenerateType
- func MapOf(typ GenerateType) GenerateType
- func Null() GenerateType
- func Number() GenerateType
- func Primitive() GenerateType
- func Ptr(maxDepth int) GenerateType
- func PtrOf(typ GenerateType) GenerateType
- func String() GenerateType
- func Struct(maxDepth int) GenerateType
- func Type(maxDepth int) GenerateType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GenerateType ¶
GenerateType is a rapid generator for reflect.Type.
func Array ¶
func Array(maxDepth int) GenerateType
Array generates a random GenerateType starting with a []T.
func ArrayOf ¶
func ArrayOf(typ GenerateType) GenerateType
ArrayOf yields a generator to []T, where T is the type given by typ.
func Map ¶
func Map(maxDepth int) GenerateType
Map generates a random GenerateType starting with a map[string]T.
func MapOf ¶
func MapOf(typ GenerateType) GenerateType
MapOf yields a generator to map[string]T, where T is the type given by typ.
func Primitive ¶
func Primitive() GenerateType
Primitive creates a random GenerateType of a primitive scalar type.
Types are primitive when they do not contain any other type.
func Ptr ¶
func Ptr(maxDepth int) GenerateType
Ptr generates a random GenerateType starting with a *T.
func PtrOf ¶
func PtrOf(typ GenerateType) GenerateType
PtrOf yields a generator to *T, where T is the type given by typ.
If typ is already a pointer, typ is returned as is.
func Struct ¶
func Struct(maxDepth int) GenerateType
Struct returns a generator for some reflect struct type.