GetTableNames implements the interface doltdb.RootValue.
(ctx context.Context, schemaName string, includeRootObjects bool)
| 430 | |
| 431 | // GetTableNames implements the interface doltdb.RootValue. |
| 432 | func (root *RootValue) GetTableNames(ctx context.Context, schemaName string, includeRootObjects bool) ([]string, error) { |
| 433 | tableMap, err := root.getTableMap(ctx, schemaName) |
| 434 | if err != nil { |
| 435 | return nil, err |
| 436 | } |
| 437 | |
| 438 | var names []string |
| 439 | err = tableMap.Iter(ctx, func(name string, _ hash.Hash) (bool, error) { |
| 440 | names = append(names, name) |
| 441 | return false, nil |
| 442 | }) |
| 443 | if err != nil { |
| 444 | return nil, err |
| 445 | } |
| 446 | if includeRootObjects { |
| 447 | if root.colls == nil { |
| 448 | root.colls, err = rootobject.LoadAllCollections(ctx, root) |
| 449 | if err != nil { |
| 450 | return nil, err |
| 451 | } |
| 452 | } |
| 453 | for _, coll := range root.colls { |
| 454 | err = coll.IterIDs(ctx, func(identifier id.Id) (stop bool, err error) { |
| 455 | tName := coll.IDToTableName(identifier) |
| 456 | if tName.Schema == schemaName { |
| 457 | names = append(names, tName.Name) |
| 458 | } |
| 459 | return false, nil |
| 460 | }) |
| 461 | if err != nil { |
| 462 | return nil, err |
| 463 | } |
| 464 | } |
| 465 | } |
| 466 | return names, nil |
| 467 | } |
| 468 | |
| 469 | // GetTableSchemaHash implements the interface doltdb.RootValue. |
| 470 | func (root *RootValue) GetTableSchemaHash(ctx context.Context, tName doltdb.TableName) (hash.Hash, error) { |
nothing calls this directly
no test coverage detected