reflect

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package reflect provides [rapid.Generator]s for reflect types.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GenerateType

type GenerateType = *rapid.Generator[reflect.Type]

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 Bool

func Bool() GenerateType

Bool returns a generator for a reflect bool type.

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 Null

func Null() GenerateType

Null returns a generator for a reflect type with no value.

func Number

func Number() GenerateType

Number returns a generator for a reflect number type.

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 String

func String() GenerateType

String returns a generator for a reflect string type.

func Struct

func Struct(maxDepth int) GenerateType

Struct returns a generator for some reflect struct type.

func Type

func Type(maxDepth int) GenerateType

Type creates a random GenerateType.

Jump to

Keyboard shortcuts

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