Fix unit tests.
This commit is contained in:
parent
9b826fff6e
commit
eccc17dc8a
10 changed files with 91 additions and 72 deletions
|
|
@ -64,19 +64,31 @@ func (c *binaryExpression) Serialize(out *queryData, options ...serializeOption)
|
|||
if c.lhs == nil {
|
||||
return errors.Newf("nil lhs.")
|
||||
}
|
||||
if c.rhs == nil {
|
||||
return errors.Newf("nil rhs.")
|
||||
}
|
||||
|
||||
_, literalLeft := c.lhs.(*literalExpression)
|
||||
_, literalRight := c.rhs.(*literalExpression)
|
||||
|
||||
if !literalLeft && !literalRight {
|
||||
out.WriteString("(")
|
||||
}
|
||||
|
||||
if err := c.lhs.Serialize(out); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
out.Write(c.operator)
|
||||
|
||||
if c.rhs == nil {
|
||||
return errors.Newf("nil rhs.")
|
||||
}
|
||||
if err := c.rhs.Serialize(out); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if !literalLeft && !literalRight {
|
||||
out.WriteString(")")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue