MCPcopy Create free account
hub / github.com/ajitpratap0/GoSQLX / getReturning

Function getReturning

pkg/transform/returning.go:24–35  ·  view source on GitHub ↗

getReturning returns a pointer to the Returning slice for supported DML statements (INSERT, UPDATE, DELETE). Returns ErrUnsupportedStatement for SELECT or DDL statements.

(stmt ast.Statement)

Source from the content-addressed store, hash-verified

22// statements (INSERT, UPDATE, DELETE). Returns ErrUnsupportedStatement for
23// SELECT or DDL statements.
24func getReturning(stmt ast.Statement) (*[]ast.Expression, error) {
25 switch s := stmt.(type) {
26 case *ast.InsertStatement:
27 return &s.Returning, nil
28 case *ast.UpdateStatement:
29 return &s.Returning, nil
30 case *ast.DeleteStatement:
31 return &s.Returning, nil
32 default:
33 return nil, &ErrUnsupportedStatement{Transform: "RETURNING", Got: stmtTypeName(stmt)}
34 }
35}
36
37// AddReturning returns a Rule that appends one or more column names to the
38// RETURNING clause of an INSERT, UPDATE, or DELETE statement. This is the

Callers 2

AddReturningFunction · 0.85
RemoveReturningFunction · 0.85

Calls 1

stmtTypeNameFunction · 0.70

Tested by

no test coverage detected