MCPcopy Index your code
hub / github.com/dropbox/godropbox / String

Method String

database/sqlbuilder/statement.go:833–876  ·  view source on GitHub ↗
(database string)

Source from the content-addressed store, hash-verified

831}
832
833func (d *deleteStatementImpl) String(database string) (sql string, err error) {
834 if !validIdentifierName(database) {
835 return "", errors.New("Invalid database name specified")
836 }
837
838 buf := new(bytes.Buffer)
839 _, _ = buf.WriteString("DELETE FROM ")
840
841 if err = writeComment(d.comment, buf); err != nil {
842 return
843 }
844
845 if d.table == nil {
846 return "", errors.Newf("nil table. Generated sql: %s", buf.String())
847 }
848
849 if err = d.table.SerializeSql(database, buf); err != nil {
850 return
851 }
852
853 if d.where == nil {
854 return "", errors.Newf(
855 "Deleting without a WHERE clause. Generated sql: %s",
856 buf.String())
857 }
858
859 _, _ = buf.WriteString(" WHERE ")
860 if err = d.where.SerializeSql(buf); err != nil {
861 return
862 }
863
864 if d.order != nil {
865 _, _ = buf.WriteString(" ORDER BY ")
866 if err = d.order.SerializeSql(buf); err != nil {
867 return
868 }
869 }
870
871 if d.limit >= 0 {
872 _, _ = buf.WriteString(fmt.Sprintf(" LIMIT %d", d.limit))
873 }
874
875 return buf.String(), nil
876}
877
878//
879// LOCK statement ===========================================================

Callers

nothing calls this directly

Calls 6

NewFunction · 0.92
NewfFunction · 0.92
validIdentifierNameFunction · 0.85
writeCommentFunction · 0.85
StringMethod · 0.65
SerializeSqlMethod · 0.65

Tested by

no test coverage detected