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

Method GetSequencesWithTable

core/sequences/collection.go:79–92  ·  view source on GitHub ↗

GetSequencesWithTable returns all sequences with the given table as the owner.

(ctx context.Context, name doltdb.TableName)

Source from the content-addressed store, hash-verified

77
78// GetSequencesWithTable returns all sequences with the given table as the owner.
79func (pgs *Collection) GetSequencesWithTable(ctx context.Context, name doltdb.TableName) ([]*Sequence, error) {
80 // For now, this function isn't used in a critical path, so we're not too worried about performance
81 if err := pgs.cacheAllSequences(ctx); err != nil {
82 return nil, err
83 }
84 var seqs []*Sequence
85 nameID := id.NewTable(name.Schema, name.Name)
86 for _, seq := range pgs.accessedMap {
87 if seq.OwnerTable == nameID {
88 seqs = append(seqs, seq)
89 }
90 }
91 return seqs, nil
92}
93
94// GetAllSequences returns a map containing all sequences in the collection, grouped by the schema they're contained in.
95// Each sequence array is also sorted by the sequence name.

Callers 4

RemoveTablesMethod · 0.80
RenameTableMethod · 0.80
OperationPerformerMethod · 0.80

Calls 2

cacheAllSequencesMethod · 0.95
NewTableFunction · 0.92

Tested by

no test coverage detected