Open connection to given tablename.
(tableName string)
| 98 | |
| 99 | // Open connection to given tablename. |
| 100 | func (m *Source) Open(tableName string) (schema.Conn, error) { |
| 101 | |
| 102 | tableName = strings.ToLower(tableName) |
| 103 | if ds, ok := m.tables[tableName]; ok { |
| 104 | return &Table{StaticDataSource: ds}, nil |
| 105 | } |
| 106 | err := m.loadTable(tableName) |
| 107 | if err != nil { |
| 108 | u.Errorf("could not load table %q err=%v", tableName, err) |
| 109 | return nil, err |
| 110 | } |
| 111 | ds := m.tables[tableName] |
| 112 | return &Table{StaticDataSource: ds}, nil |
| 113 | } |
| 114 | |
| 115 | // Table get table schema for given table name. If given table is not currently |
| 116 | // defined, will load, infer schema. |