MCPcopy
hub / github.com/dropbox/godropbox / SerializeSql

Method SerializeSql

database/sqlbuilder/expression.go:559–592  ·  view source on GitHub ↗
(out *bytes.Buffer)

Source from the content-addressed store, hash-verified

557}
558
559func (c *inExpression) SerializeSql(out *bytes.Buffer) error {
560 if c.err != nil {
561 return errors.Wrap(c.err, "Invalid IN expression")
562 }
563
564 if c.lhs == nil {
565 return errors.Newf(
566 "lhs of in expression is nil. Generated sql: %s",
567 out.String())
568 }
569
570 // We'll serialize the lhs even if we don't need it to ensure no error
571 buf := &bytes.Buffer{}
572
573 err := c.lhs.SerializeSql(buf)
574 if err != nil {
575 return err
576 }
577
578 if c.rhs == nil {
579 _, _ = out.WriteString("FALSE")
580 return nil
581 }
582
583 _, _ = out.WriteString(buf.String())
584 _, _ = out.WriteString(" IN ")
585
586 err = c.rhs.SerializeSql(out)
587 if err != nil {
588 return err
589 }
590
591 return nil
592}
593
594// Returns a representation of "a IN (b[0], ..., b[n-1])", where b is a list
595// of literals valList must be a slice type

Callers

nothing calls this directly

Calls 4

WrapFunction · 0.92
NewfFunction · 0.92
StringMethod · 0.65
SerializeSqlMethod · 0.65

Tested by

no test coverage detected