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

Method GetTableHash

core/rootvalue.go:398–429  ·  view source on GitHub ↗

GetTableHash implements the interface doltdb.RootValue.

(ctx context.Context, tName doltdb.TableName)

Source from the content-addressed store, hash-verified

396
397// GetTableHash implements the interface doltdb.RootValue.
398func (root *RootValue) GetTableHash(ctx context.Context, tName doltdb.TableName) (hash.Hash, bool, error) {
399 // Check the tables first
400 tableMap, err := root.getTableMap(ctx, tName.Schema)
401 if err != nil {
402 return hash.Hash{}, false, err
403 }
404 tVal, err := tableMap.Get(ctx, tName.Name)
405 if err != nil {
406 return hash.Hash{}, false, err
407 }
408 if !tVal.IsEmpty() {
409 return tVal, true, nil
410 }
411 // Then check the root objects
412 _, rawID, objID, err := rootobject.ResolveName(ctx, root, tName)
413 if err != nil {
414 return hash.Hash{}, false, err
415 }
416 if objID == objinterface.RootObjectID_None {
417 return hash.Hash{}, false, nil
418 }
419 coll, err := rootobject.LoadCollection(ctx, root, objID)
420 if err != nil {
421 return hash.Hash{}, false, err
422 }
423 obj, ok, err := coll.GetRootObject(ctx, rawID)
424 if err != nil || !ok {
425 return hash.Hash{}, false, err
426 }
427 h, err := obj.HashOf(ctx)
428 return h, err == nil && !h.IsEmpty(), err
429}
430
431// GetTableNames implements the interface doltdb.RootValue.
432func (root *RootValue) GetTableNames(ctx context.Context, schemaName string, includeRootObjects bool) ([]string, error) {

Callers

nothing calls this directly

Calls 7

getTableMapMethod · 0.95
ResolveNameFunction · 0.92
LoadCollectionFunction · 0.92
GetRootObjectMethod · 0.65
GetMethod · 0.45
IsEmptyMethod · 0.45
HashOfMethod · 0.45

Tested by

no test coverage detected