Documentation
¶
Index ¶
Constants ¶
View Source
const ( // UnsafeDisabled is a build-time constant which specifies whether or // not access to the unsafe package is available. UnsafeDisabled = false )
Variables ¶
View Source
var GetInterface = func(val reflect.Value, force bool) (interface{}, bool) { if !val.IsValid() { return nil, true } if val.CanInterface() { return val.Interface(), true } if force { val = unsafeReflectValue(val) if val.CanInterface() { return val.Interface(), true } } copyVal, ok := CopyValue(val) if ok && copyVal.CanInterface() { return copyVal.Interface(), true } return nil, false }
GetInterface does its best to return the data behind val. If force is true, it tries to bypass golang protections using the unsafe package.
It returns (nil, false) if the data behind val can not be retrieved as an interface{} (aka. struct private + non-copyable field).
Functions ¶
func MustGetInterface ¶
MustGetInterface does its best to return the data behind val. If it fails (struct private + non-copyable field), it panics.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.