GetSequencesWithTable returns all sequences with the given table as the owner.
(ctx context.Context, name doltdb.TableName)
| 77 | |
| 78 | // GetSequencesWithTable returns all sequences with the given table as the owner. |
| 79 | func (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. |
no test coverage detected