Table get table schema for given table name. If given table is not currently defined, will load, infer schema.
(tableName string)
| 115 | // Table get table schema for given table name. If given table is not currently |
| 116 | // defined, will load, infer schema. |
| 117 | func (m *Source) Table(tableName string) (*schema.Table, error) { |
| 118 | |
| 119 | tableName = strings.ToLower(tableName) |
| 120 | if ds, ok := m.tables[tableName]; ok { |
| 121 | return ds.Table(tableName) |
| 122 | } |
| 123 | err := m.loadTable(tableName) |
| 124 | if err != nil { |
| 125 | u.Errorf("could not load table %q err=%v", tableName, err) |
| 126 | return nil, err |
| 127 | } |
| 128 | ds, ok := m.tables[tableName] |
| 129 | if !ok { |
| 130 | return nil, schema.ErrNotFound |
| 131 | } |
| 132 | return ds.Table(tableName) |
| 133 | } |
| 134 | |
| 135 | func (m *Source) loadTable(tableName string) error { |
| 136 |