Table gets a table (YAML subsection) from a Values object. The table is returned as a Values. Compound table names may be specified with dots: foo.bar The above will be evaluated as "The table bar inside the table foo". An ErrNoTable is returned if the table does not exist.
(name string)
| 50 | // |
| 51 | // An ErrNoTable is returned if the table does not exist. |
| 52 | func (v Values) Table(name string) (Values, error) { |
| 53 | table := v |
| 54 | var err error |
| 55 | |
| 56 | for _, n := range parsePath(name) { |
| 57 | if table, err = tableLookup(table, n); err != nil { |
| 58 | break |
| 59 | } |
| 60 | } |
| 61 | return table, err |
| 62 | } |
| 63 | |
| 64 | // AsMap is a utility function for converting Values to a map[string]interface{}. |
| 65 | // |