inspector

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2019 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package inspector is a package of utility functions for inspecting field names and keys from objects.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetFieldNames

func GetFieldNames(object interface{}, sorted bool, reversed bool) []string

GetFieldNames returns the field names of a struct as []string. If you want the field names to be sorted in alphabetical order, pass sorted equal to true. If sorted and reversed, then sorts in reverse alphabetical order.

func GetFieldNamesFromValue

func GetFieldNamesFromValue(value reflect.Value, sorted bool, reversed bool) []string

GetFieldNamesFromValue returns the field names of a struct as []string. If you want the field names to be sorted in alphabetical order, pass sorted equal to true. If sorted and reversed, then sorts in reverse alphabetical order.

func GetKeys

func GetKeys(object interface{}, sorted bool, reversed bool) []interface{}

GetKeys returns the keys for a map as an []interface{}. If you want the keys to be sorted in alphabetical order, pass sorted equal to true. If sorted and reversed, then sorts in reverse alphabetical order.

func GetKeysFromValue

func GetKeysFromValue(m reflect.Value, sorted bool, reversed bool) []interface{}

GetKeysFromValue returns the keys for a map as an []interface{}. If you want the keys to be sorted in alphabetical order, pass sorted equal to true. If sorted and reversed, then sorts in reverse alphabetical order.

func GetUnknownFieldNamesFromValue added in v0.0.9

func GetUnknownFieldNamesFromValue(value reflect.Value, knownKeys map[string]struct{}, sorted bool, reversed bool) []string

GetUnknownFieldNamesFromValue returns the unknown field names for a struct as a []string{} given a set of known field names. If you want the field names to be sorted in alphabetical order, pass sorted equal to true. If sorted and reversed, then sorts in reverse alphabetical order.

func GetUnknownKeys

func GetUnknownKeys(object interface{}, knownKeys map[interface{}]struct{}, sorted bool, reversed bool) []interface{}

GetUnknownKeys returns the unknown keys for a map as an []interface{} given a set of known keys. If you want the keys to be sorted in alphabetical order, pass sorted equal to true. If sorted and reversed, then sorts in reverse alphabetical order.

func GetUnknownKeysFromValue

func GetUnknownKeysFromValue(m reflect.Value, knownKeys map[interface{}]struct{}, sorted bool, reversed bool) []interface{}

GetUnknownKeysFromValue returns the unknown keys for a map as an []interface{} given a set of known keys. If you want the keys to be sorted in alphabetical order, pass sorted equal to true. If sorted and reversed, then sorts in reverse alphabetical order.

Types

This section is empty.

Jump to

Keyboard shortcuts

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