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

Method GetAllTableNames

core/rootvalue.go:271–311  ·  view source on GitHub ↗

GetAllTableNames implements the interface doltdb.RootValue.

(ctx context.Context, includeRootObjects bool)

Source from the content-addressed store, hash-verified

269
270// GetAllTableNames implements the interface doltdb.RootValue.
271func (root *RootValue) GetAllTableNames(ctx context.Context, includeRootObjects bool) ([]doltdb.TableName, error) {
272 var names []doltdb.TableName
273
274 existingSchemas, err := root.st.GetSchemas(ctx)
275 if err != nil {
276 return nil, err
277 }
278 for _, existingSchema := range existingSchemas {
279 tableMap, err := root.getTableMap(ctx, existingSchema.Name)
280 if err != nil {
281 return nil, err
282 }
283
284 err = tableMap.Iter(ctx, func(name string, _ hash.Hash) (bool, error) {
285 names = append(names, doltdb.TableName{
286 Name: name,
287 Schema: existingSchema.Name,
288 })
289 return false, nil
290 })
291 if err != nil {
292 return nil, err
293 }
294 }
295 if includeRootObjects {
296 colls, err := rootobject.LoadAllCollections(ctx, root)
297 if err != nil {
298 return nil, err
299 }
300 for _, coll := range colls {
301 err = coll.IterIDs(ctx, func(identifier id.Id) (stop bool, err error) {
302 names = append(names, coll.IDToTableName(identifier))
303 return false, nil
304 })
305 if err != nil {
306 return nil, err
307 }
308 }
309 }
310 return names, nil
311}
312
313// GetCollation implements the interface doltdb.RootValue.
314func (root *RootValue) GetCollation(ctx context.Context) (schema.Collation, error) {

Callers 7

BeforeTableModifyColumnFunction · 0.80
AfterTableDropColumnFunction · 0.80
AfterTableRenameColumnFunction · 0.80
AfterTableRenameFunction · 0.80
BeforeTableAddColumnFunction · 0.80
AfterTableAddColumnFunction · 0.80

Calls 6

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

Tested by

no test coverage detected