types

package
v0.0.0-...-d6ccb58 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2022 License: LGPL-3.0-or-later Imports: 1 Imported by: 1

Documentation

Overview

This package contains instances of "reflect.Type".

BasicTypes

Contains types over builting types of GoLang

int64Type := BasicTypes.OfInt64()

PointerTypes

Contains types of pointer to builting types of GoLang

strPtrType := PointerTypes.OfString()

SliceTypes

Contains types of slice for builting types of GoLang

sliceUint8Type := SliceTypes.OfUint8()

ArrayTypes

Contains types of array for builting types of GoLang.

array10IntType := ArrayTypes(10).OfInt()

The instances for this reflection is not cached by this package.

ErrorType

As "reflect.Type" for "error" interface.

TrueValue

As the instance of "reflect.Value" for "true"

someValue := TrueValue

FalseValue

someValue := FalseValue

As the instance of "reflect.Value" for "false"

Index

Examples

Constants

This section is empty.

Variables

View Source
var (
	/**
	 * Boolean values
	 */
	TrueValue  = reflect.ValueOf(true)
	FalseValue = reflect.ValueOf(false)
)
View Source
var ErrorType reflect.Type = reflect.TypeOf((*error)(nil)).Elem()

Instance of "reflect.Type" for "error"(interface)

Functions

This section is empty.

Types

type BuiltinTypeSpace

type BuiltinTypeSpace interface {
	// Gets instance of "reflect.Type" relating to "int"
	OfInt() reflect.Type
	// Gets instance of "reflect.Type" relating to "int64"
	OfInt64() reflect.Type
	// Gets instance of "reflect.Type" relating to "int32"
	OfInt32() reflect.Type
	// Gets instance of "reflect.Type" relating to "int16"
	OfInt16() reflect.Type
	// Gets instance of "reflect.Type" relating to "int8"
	OfInt8() reflect.Type
	// Gets instance of "reflect.Type" relating to "uint"
	OfUint() reflect.Type
	// Gets instance of "reflect.Type" relating to "uint64"
	OfUint64() reflect.Type
	// Gets instance of "reflect.Type" relating to "uint32"
	OfUint32() reflect.Type
	// Gets instance of "reflect.Type" relating to "uint16"
	OfUint16() reflect.Type
	// Gets instance of "reflect.Type" relating to "uint8"
	OfUint8() reflect.Type
	// Gets instance of "reflect.Type" relating to "float32"
	OfFloat32() reflect.Type
	// Gets instance of "reflect.Type" relating to "float64"
	OfFloat64() reflect.Type
	// Gets instance of "reflect.Type" relating to "complex64"
	OfComplex64() reflect.Type
	// Gets instance of "reflect.Type" relating to "complex128"
	OfComplex128() reflect.Type
	// Gets instance of "reflect.Type" relating to "byte"
	OfByte() reflect.Type
	// Gets instance of "reflect.Type" relating to "bool"
	OfBool() reflect.Type
	// Gets instance of "reflect.Type" relating to "string"
	OfString() reflect.Type
}

Defines the interface to get "reflect.Type" instance for builtin types

See: "BasicTypes", "PointerTypes", "SliceTypes"

Example (Array)
uint8ArrayType := ArrayTypes(5).OfUint8()

fmt.Printf("[%d]%v", uint8ArrayType.Len(), uint8ArrayType.Kind())
Output:

[5]array
Example (Basic)
fmt.Printf("%v", BasicTypes.OfInt16().Kind())
Output:

int16
Example (Pointer)
fmt.Printf("%v", PointerTypes.OfString().Kind())
Output:

ptr
Example (Slice)
fmt.Printf("%v", SliceTypes.OfFloat64().Kind())
Output:

slice
var BasicTypes BuiltinTypeSpace = &spaceImpl{
	instanceOfInt:    reflect.TypeOf(int(0)),
	instanceOfInt64:  reflect.TypeOf(int64(0)),
	instanceOfInt32:  reflect.TypeOf(int32(0)),
	instanceOfInt16:  reflect.TypeOf(int16(0)),
	instanceOfInt8:   reflect.TypeOf(int8(0)),
	instanceOfUint:   reflect.TypeOf(uint(0)),
	instanceOfUint64: reflect.TypeOf(uint64(0)),
	instanceOfUint32: reflect.TypeOf(uint32(0)),
	instanceOfUint16: reflect.TypeOf(uint16(0)),
	instanceOfUint8:  reflect.TypeOf(uint8(0)),

	instanceOfFloat32: reflect.TypeOf(float32(0)),
	instanceOfFloat64: reflect.TypeOf(float64(0)),

	instanceOfComplex64:  reflect.TypeOf(complex64(0)),
	instanceOfComplex128: reflect.TypeOf(complex128(0)),

	instanceOfByte:   reflect.TypeOf(byte(0)),
	instanceOfBool:   reflect.TypeOf(true),
	instanceOfString: reflect.TypeOf(""),
}

Contains instance of "reflect.Type" over builtin types of GoLang

See: "reflect.TypeOf"

var PointerTypes BuiltinTypeSpace = &spaceImpl{
	instanceOfInt:    reflect.PtrTo(BasicTypes.OfInt()),
	instanceOfInt64:  reflect.PtrTo(BasicTypes.OfInt64()),
	instanceOfInt32:  reflect.PtrTo(BasicTypes.OfInt32()),
	instanceOfInt16:  reflect.PtrTo(BasicTypes.OfInt16()),
	instanceOfInt8:   reflect.PtrTo(BasicTypes.OfInt8()),
	instanceOfUint:   reflect.PtrTo(BasicTypes.OfUint()),
	instanceOfUint64: reflect.PtrTo(BasicTypes.OfUint64()),
	instanceOfUint32: reflect.PtrTo(BasicTypes.OfUint32()),
	instanceOfUint16: reflect.PtrTo(BasicTypes.OfUint16()),
	instanceOfUint8:  reflect.PtrTo(BasicTypes.OfUint8()),

	instanceOfFloat32: reflect.PtrTo(BasicTypes.OfFloat32()),
	instanceOfFloat64: reflect.PtrTo(BasicTypes.OfFloat64()),

	instanceOfComplex64:  reflect.PtrTo(BasicTypes.OfComplex64()),
	instanceOfComplex128: reflect.PtrTo(BasicTypes.OfComplex128()),

	instanceOfByte:   reflect.PtrTo(BasicTypes.OfByte()),
	instanceOfBool:   reflect.PtrTo(BasicTypes.OfBool()),
	instanceOfString: reflect.PtrTo(BasicTypes.OfString()),
}

Contains instances of "reflect.Type" over pointer of builtin types of GoLang

See: "reflect.PtrTo"

var SliceTypes BuiltinTypeSpace = &spaceImpl{
	instanceOfInt:    reflect.SliceOf(BasicTypes.OfInt()),
	instanceOfInt64:  reflect.SliceOf(BasicTypes.OfInt64()),
	instanceOfInt32:  reflect.SliceOf(BasicTypes.OfInt32()),
	instanceOfInt16:  reflect.SliceOf(BasicTypes.OfInt16()),
	instanceOfInt8:   reflect.SliceOf(BasicTypes.OfInt8()),
	instanceOfUint:   reflect.SliceOf(BasicTypes.OfUint()),
	instanceOfUint64: reflect.SliceOf(BasicTypes.OfUint64()),
	instanceOfUint32: reflect.SliceOf(BasicTypes.OfUint32()),
	instanceOfUint16: reflect.SliceOf(BasicTypes.OfUint16()),
	instanceOfUint8:  reflect.SliceOf(BasicTypes.OfUint8()),

	instanceOfFloat32: reflect.SliceOf(BasicTypes.OfFloat32()),
	instanceOfFloat64: reflect.SliceOf(BasicTypes.OfFloat64()),

	instanceOfComplex64:  reflect.SliceOf(BasicTypes.OfComplex64()),
	instanceOfComplex128: reflect.SliceOf(BasicTypes.OfComplex128()),

	instanceOfByte:   reflect.SliceOf(BasicTypes.OfByte()),
	instanceOfBool:   reflect.SliceOf(BasicTypes.OfBool()),
	instanceOfString: reflect.SliceOf(BasicTypes.OfString()),
}

Contains instances of "reflect.Type" over slice of builtin types of GoLang

See: "reflect.SliceOf"

func ArrayTypes

func ArrayTypes(count int) BuiltinTypeSpace

Contains instances of "reflect.Type" over array of builtin types of GoLang

count - The length of array

See: "reflect.ArrayOf"

Jump to

Keyboard shortcuts

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