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

Method GetForeignKeyCollection

core/rootvalue.go:354–370  ·  view source on GitHub ↗

GetForeignKeyCollection implements the interface doltdb.RootValue.

(ctx context.Context)

Source from the content-addressed store, hash-verified

352
353// GetForeignKeyCollection implements the interface doltdb.RootValue.
354func (root *RootValue) GetForeignKeyCollection(ctx context.Context) (*doltdb.ForeignKeyCollection, error) {
355 if root.fkc == nil {
356 fkMap, ok, err := root.st.GetForeignKeys(ctx, root.vrw)
357 if err != nil {
358 return nil, err
359 }
360 if !ok {
361 return doltdb.NewForeignKeyCollection()
362 }
363
364 root.fkc, err = doltdb.DeserializeForeignKeys(ctx, root.vrw.Format(), fkMap)
365 if err != nil {
366 return nil, err
367 }
368 }
369 return root.fkc.Copy(), nil
370}
371
372// GetRootObject implements the interface doltdb.RootValue.
373func (root *RootValue) GetRootObject(ctx context.Context, tName doltdb.TableName) (doltdb.RootObject, bool, error) {

Callers 2

DebugStringMethod · 0.95
RemoveTablesMethod · 0.80

Calls 3

GetForeignKeysMethod · 0.80
FormatMethod · 0.65
CopyMethod · 0.65

Tested by

no test coverage detected