GetDoltTableFromContext returns the Dolt table from the context. Returns nil if no table was found.
(ctx *sql.Context, tableName doltdb.TableName)
| 167 | |
| 168 | // GetDoltTableFromContext returns the Dolt table from the context. Returns nil if no table was found. |
| 169 | func GetDoltTableFromContext(ctx *sql.Context, tableName doltdb.TableName) (*doltdb.Table, error) { |
| 170 | _, root, err := GetRootFromContext(ctx) |
| 171 | if err != nil { |
| 172 | return nil, err |
| 173 | } |
| 174 | |
| 175 | var table *doltdb.Table |
| 176 | if tableName.Schema == "" { |
| 177 | _, table, _, err = resolve.Table(ctx, root, tableName.Name) |
| 178 | if err != nil { |
| 179 | return nil, err |
| 180 | } |
| 181 | } else { |
| 182 | table, _, err = root.GetTable(ctx, tableName) |
| 183 | } |
| 184 | |
| 185 | if err != nil { |
| 186 | return nil, err |
| 187 | } |
| 188 | |
| 189 | return table, nil |
| 190 | } |
| 191 | |
| 192 | // GetSqlDatabaseFromContext returns the database from the context. Uses the context's current database if an empty |
| 193 | // string is provided. Returns nil if the database was not found. |
nothing calls this directly
no test coverage detected