reflectish

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: May 1, 2025 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package reflectish provides common reflection utilities that extend Go's standard "reflect" library.

It offers:

  • IndirectDeep: recursively dereferences pointers until a non-pointer value is reached.
  • LengthOf: returns the length of supported types (arrays, slices, maps, strings, channels), along with a boolean indicating support.

Usage:

import "github.com/amberpixels/abu/reflectish"

// Deeply dereference pointers
val := reflect.ValueOf(&&myStruct)
root := reflectish.IndirectDeep(val)

// Get length of a slice, map, etc.
length, ok := reflectish.LengthOf([]int{1,2,3})
if ok {
    fmt.Println("Length:", length)
}

Package reflectish is intended as a lightweight helper for reflection-based operations.

Package reflectish contains helpers that extends standard reflect library

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IndirectDeep

func IndirectDeep(v reflect.Value) reflect.Value

IndirectDeep does reflect.Indirect deeply.

func LengthOf

func LengthOf(a any) (int, bool)

LengthOf returns length of a given type.

Types

This section is empty.

Jump to

Keyboard shortcuts

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