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

Method RowIter

server/node/drop_cast.go:65–82  ·  view source on GitHub ↗

RowIter implements the interface sql.ExecSourceRel.

(ctx *sql.Context, r sql.Row)

Source from the content-addressed store, hash-verified

63
64// RowIter implements the interface sql.ExecSourceRel.
65func (c *DropCast) RowIter(ctx *sql.Context, r sql.Row) (sql.RowIter, error) {
66 castCollection, err := core.GetCastsCollectionFromContext(ctx, "")
67 if err != nil {
68 return nil, err
69 }
70 castID := id.NewCast(c.Source.ID, c.Target.ID)
71 if !castCollection.HasCast(ctx, castID) {
72 if c.IfExists {
73 // TODO: send notice "cast from type SOURCE_NAME to type TARGET_NAME does not exist, skipping"
74 return sql.RowsToRowIter(), nil
75 }
76 return nil, errors.Errorf("cast from type %s to type %s does not exist", c.Source.Name(), c.Target.Name())
77 }
78 if err = castCollection.DropCast(ctx, castID); err != nil {
79 return nil, err
80 }
81 return sql.RowsToRowIter(), nil
82}
83
84// Schema implements the interface sql.ExecSourceRel.
85func (c *DropCast) Schema(ctx *sql.Context) sql.Schema {

Callers

nothing calls this directly

Calls 6

NewCastFunction · 0.92
HasCastMethod · 0.80
DropCastMethod · 0.80
ErrorfMethod · 0.65
NameMethod · 0.65

Tested by

no test coverage detected