MCPcopy Create free account
hub / github.com/araddon/qlbridge / Table

Method Table

schema/schema.go:210–237  ·  view source on GitHub ↗

Table gets Table definition for given table name

(tableIn string)

Source from the content-addressed store, hash-verified

208
209// Table gets Table definition for given table name
210func (m *Schema) Table(tableIn string) (*Table, error) {
211
212 tableName := strings.ToLower(tableIn)
213
214 m.mu.RLock()
215 defer m.mu.RUnlock()
216
217 // u.Debugf("%p looking up %q", m, tableName)
218
219 tbl, ok := m.tableMap[tableName]
220 if ok && tbl != nil {
221 return tbl, nil
222 }
223
224 // Lets see if it is `schema`.`table` format
225 _, tableName, ok = expr.LeftRight(tableName)
226 if ok {
227 tbl, ok = m.tableMap[tableName]
228 if ok && tbl != nil {
229 return tbl, nil
230 }
231 }
232
233 if m.SchemaRef != nil {
234 return m.SchemaRef.Table(tableIn)
235 }
236 return nil, fmt.Errorf("Could not find that table: %v", tableIn)
237}
238
239// OpenConn get a connection from this schema by table name.
240func (m *Schema) OpenConn(tableName string) (Conn, error) {

Callers 1

TestSchemaFunction · 0.95

Calls 3

LeftRightFunction · 0.92
ErrorfMethod · 0.80
TableMethod · 0.65

Tested by 1

TestSchemaFunction · 0.76