reflect

package
v0.0.0-...-50cb774 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2016 License: BSD-2-Clause-Views Imports: 4 Imported by: 2

Documentation

Overview

This package provides some punk-rock reflection which is not in the stdlib.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FieldsAndValues

func FieldsAndValues(val interface{}) ([]string, []interface{}, bool)

FieldsAndValues returns a list field names and a corresponing list of values for the given struct. For details on how the field names are determined please see StructToMap.

func MapToStruct

func MapToStruct(m map[string]interface{}, struc interface{}) error

MapToStruct converts a map to a struct. It is the inverse of the StructToMap function. For details see StructToMap.

func StructToMap

func StructToMap(val interface{}) (map[string]interface{}, bool)

StructToMap converts a struct to map. The object's default key string is the struct field name but can be specified in the struct field's tag value. The "cql" key in the struct field's tag value is the key name. Examples:

// Field appears in the resulting map as key "myName".
Field int `cql:"myName"`

// Field appears in the resulting as key "Field"
Field int

// Field appears in the resulting map as key "myName"
Field int "myName"

Types

This section is empty.

Jump to

Keyboard shortcuts

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