RowIter implements the interface sql.ExecSourceRel.
(ctx *sql.Context, r sql.Row)
| 95 | |
| 96 | // RowIter implements the interface sql.ExecSourceRel. |
| 97 | func (g *Grant) RowIter(ctx *sql.Context, r sql.Row) (sql.RowIter, error) { |
| 98 | var err error |
| 99 | auth.LockWrite(func() { |
| 100 | switch { |
| 101 | case g.GrantTable != nil: |
| 102 | if err = g.grantTable(ctx); err != nil { |
| 103 | return |
| 104 | } |
| 105 | case g.GrantSchema != nil: |
| 106 | if err = g.grantSchema(ctx); err != nil { |
| 107 | return |
| 108 | } |
| 109 | case g.GrantDatabase != nil: |
| 110 | if err = g.grantDatabase(ctx); err != nil { |
| 111 | return |
| 112 | } |
| 113 | case g.GrantSequence != nil: |
| 114 | if err = g.grantSequence(ctx); err != nil { |
| 115 | return |
| 116 | } |
| 117 | case g.GrantRoutine != nil: |
| 118 | if err = g.grantRoutine(ctx); err != nil { |
| 119 | return |
| 120 | } |
| 121 | case g.GrantRole != nil: |
| 122 | if err = g.grantRole(ctx); err != nil { |
| 123 | return |
| 124 | } |
| 125 | default: |
| 126 | err = errors.Errorf("GRANT statement is not yet supported") |
| 127 | return |
| 128 | } |
| 129 | err = auth.PersistChanges() |
| 130 | }) |
| 131 | if err != nil { |
| 132 | return nil, err |
| 133 | } |
| 134 | return sql.RowsToRowIter(), nil |
| 135 | } |
| 136 | |
| 137 | // Schema implements the interface sql.ExecSourceRel. |
| 138 | func (g *Grant) Schema(ctx *sql.Context) sql.Schema { |
nothing calls this directly
no test coverage detected