@@ -1545,11 +1545,6 @@ func (c *CustomFuncs) IntConst(d *tree.DInt) opt.ScalarExpr {
1545
1545
return c .f .ConstructConst (d , types .Int )
1546
1546
}
1547
1547
1548
- // StrConst constructs a Const holding a DString.
1549
- func (c * CustomFuncs ) StrConst (d * tree.DString ) opt.ScalarExpr {
1550
- return c .f .ConstructConst (d , types .String )
1551
- }
1552
-
1553
1548
// StringFromConst extracts a string from a Const expression. It returns the
1554
1549
// string and a boolean indicating whether the extraction was successful.
1555
1550
func (c * CustomFuncs ) StringFromConst (expr opt.ScalarExpr ) (string , bool ) {
@@ -1565,14 +1560,13 @@ func (c *CustomFuncs) StringFromConst(expr opt.ScalarExpr) (string, bool) {
1565
1560
return "" , false
1566
1561
}
1567
1562
1568
- // EqualConstString compares two Const expressions to see if they hold equal string values.
1569
- func (c * CustomFuncs ) EqualConstStrings (left , right opt.ScalarExpr ) bool {
1570
- leftStr , okLeft := c .StringFromConst (left )
1571
- rightStr , okRight := c .StringFromConst (right )
1572
- if ! okLeft || ! okRight {
1573
- return false
1563
+ // ConstStringEquals returns true if e is a constant string expression and is
1564
+ // equal to other.
1565
+ func (c * CustomFuncs ) ConstStringEquals (e opt.ScalarExpr , other * tree.DString ) bool {
1566
+ if eStr , ok := c .StringFromConst (e ); ok {
1567
+ return eStr == string (* other )
1574
1568
}
1575
- return leftStr == rightStr
1569
+ return false
1576
1570
}
1577
1571
1578
1572
// IsGreaterThan returns true if the first datum compares as greater than the
0 commit comments