preflect

package
v0.4.186 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2024 License: ISC Imports: 8 Imported by: 0

Documentation

Overview

Package preflect obtains underlying type using reflection

Index

Constants

View Source
const (
	Nil = "nil"
)

Variables

This section is empty.

Functions

func FuncName added in v0.4.174

func FuncName(funcOrMethod any) (cL *pruntime.CodeLocation, err error)

FuncName returns information on a function value

  • funcOrMethod: non-nil function value such as:
  • — a top-level function: “func main() {”
  • — a method: “errors.New("").Error”
  • — an anonymous function: “var f = func() {}” returned like “SomeFunc.func1”
  • cL is a function-describing structure of basic types only
  • pruntime.CodeLocation.FuncIdentifier returns the function name identifier, a single word
  • error is returned if:
  • — funcOrMethod is nil or not a function value
  • — function value retrieval failed in runtime

func IntValue

func IntValue(value any) (u64 uint64, i64 int64, hasValue, isSigned, isPointer bool)

IntValue returns the integer value of value

  • hasValue is true and u64 is initialized for any integer, pointer or nil
  • for signed integer types, isSigned is true and i64 has value
  • isPointer indicates that u64 holds a pointer value
  • nil returns: u64 = 0, hasValue true, isPointer true, isSigned false
  • superseded by non-reflection version github.com/haraldrudell/parl/ints.IntProperties

func PredeclaredType

func PredeclaredType(value any) (s string)

PredeclaredType returns a string describing the underlying type of value

  • examples: "bool" "uint8" "int(64)"
  • no named types or type aliases

Types

This section is empty.

Jump to

Keyboard shortcuts

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