Skip to content

Commit 299d3cd

Browse files
authored
Fix trim last separator (#38)
1 parent d4c2d1b commit 299d3cd

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

builq.go

+2-5
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,8 @@ func (b *Builder) build() (_ string, _ []any) {
125125
b.setErr(err)
126126
}
127127

128-
// drop last separator for clarity.
129-
q := query.String()
130-
if q[len(q)-1] == b.sep {
131-
q = q[:len(q)-1]
132-
}
128+
// drop last separators for clarity.
129+
q := strings.TrimRight(query.String(), string(b.sep))
133130
return q, resArgs
134131
}
135132

example_test.go

-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ func ExampleNew() {
5656
// SELECT foo, bar FROM users
5757
// WHERE active IS TRUE
5858
// AND user_id = $1 OR user = $2
59-
//
6059
// args:
6160
// [42 root]
6261
// debug:

0 commit comments

Comments
 (0)