MCPcopy Create free account
hub / github.com/dolthub/doltgresql / GetTableNames

Method GetTableNames

core/rootvalue.go:432–467  ·  view source on GitHub ↗

GetTableNames implements the interface doltdb.RootValue.

(ctx context.Context, schemaName string, includeRootObjects bool)

Source from the content-addressed store, hash-verified

430
431// GetTableNames implements the interface doltdb.RootValue.
432func (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.
470func (root *RootValue) GetTableSchemaHash(ctx context.Context, tName doltdb.TableName) (hash.Hash, error) {

Callers

nothing calls this directly

Calls 5

getTableMapMethod · 0.95
LoadAllCollectionsFunction · 0.92
IterIDsMethod · 0.65
IDToTableNameMethod · 0.65
IterMethod · 0.45

Tested by

no test coverage detected