valuesEqual returns true if the left value is equal to the row provided using the equality functions previously assigned to |compFuncs| during analysis. If the left value is a single scalar, then |row| has a single value as well. Otherwise, (left is a tuple), |row| has a matching number of values.
(ctx *sql.Context, left interface{}, row sql.Row)
| 129 | // assigned to |compFuncs| during analysis. If the left value is a single scalar, then |row| has a single value as |
| 130 | // well. Otherwise, (left is a tuple), |row| has a matching number of values. |
| 131 | func (in *InSubquery) valuesEqual(ctx *sql.Context, left interface{}, row sql.Row) (bool, error) { |
| 132 | // Note that we have to edit the literals in place, since the comparison functions reference them directly. |
| 133 | in.leftLiteral.Val = left |
| 134 | for i, v := range row { |
| 135 | in.rightLiterals[i].Val = v |
| 136 | } |
| 137 | |
| 138 | for _, compFunc := range in.compFuncs { |
| 139 | result, err := compFunc.Eval(ctx, nil) |
| 140 | if err != nil { |
| 141 | return false, err |
| 142 | } |
| 143 | if !result.(bool) { |
| 144 | return false, nil |
| 145 | } |
| 146 | } |
| 147 | return true, nil |
| 148 | } |
| 149 | |
| 150 | // IsNullable implements the sql.Expression interface. |
| 151 | func (in *InSubquery) IsNullable(ctx *sql.Context) bool { |