diff --git a/field.go b/field.go index 510ab71..cd751ca 100644 --- a/field.go +++ b/field.go @@ -2,19 +2,25 @@ package structure import "reflect" -// Field represents a single struct field that encapsulates many high level -// function around a singel struct field +// Field represents a single struct field that encapsulates high level +// functions around the field. type Field struct { value reflect.Value field reflect.StructField } // Tag returns the value associated with key in the tag string. If there is no -// such key in the tag, Tag returns the empty string +// such key in the tag, Tag returns the empty string. func (f *Field) Tag(key string) string { return f.field.Tag.Get(key) } +// Value returns the underlying value of of the field. func (f *Field) Value() interface{} { return f.value.Interface() } + +// IsEmbedded returns true if the given field is an anonymous field (embedded) +func (f *Field) IsEmbedded() bool { + return f.field.Anonymous +}