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

Method IterateCasts

core/casts/collection.go:535–562  ·  view source on GitHub ↗

IterateCasts iterates over all casts in the collection.

(ctx context.Context, callback func(c Cast) (stop bool, err error))

Source from the content-addressed store, hash-verified

533
534// IterateCasts iterates over all casts in the collection.
535func (pgc *Collection) IterateCasts(ctx context.Context, callback func(c Cast) (stop bool, err error)) error {
536 for _, cast := range builtInCasts {
537 stop, err := callback(cast)
538 if err != nil {
539 return err
540 } else if stop {
541 return nil
542 }
543 }
544 return pgc.underlyingMap.IterAll(ctx, func(_ string, v hash.Hash) error {
545 data, err := pgc.ns.ReadBytes(ctx, v)
546 if err != nil {
547 return err
548 }
549 c, err := DeserializeCast(ctx, data)
550 if err != nil {
551 return err
552 }
553 stop, err := callback(c)
554 if err != nil {
555 return err
556 } else if stop {
557 return io.EOF
558 } else {
559 return nil
560 }
561 })
562}
563
564// Clone returns a new *Collection with the same contents as the original.
565func (pgc *Collection) Clone(ctx context.Context) *Collection {

Callers 3

IterAllMethod · 0.95
resolveNameMethod · 0.95
RowIterMethod · 0.80

Calls 3

DeserializeCastFunction · 0.85
ReadBytesMethod · 0.80
IterAllMethod · 0.65

Tested by

no test coverage detected