Join adds a query part with a custom separator. The separator is prepended to the text (except for the first part).
(separator, text string, params ...any)
| 29 | // Join adds a query part with a custom separator. |
| 30 | // The separator is prepended to the text (except for the first part). |
| 31 | func (q *Query) Join(separator, text string, params ...any) *Query { |
| 32 | if q == nil { |
| 33 | q = Q() |
| 34 | } |
| 35 | // Prepend separator if not the first part |
| 36 | if len(q.parts) > 0 { |
| 37 | text = separator + text |
| 38 | } |
| 39 | q.parts = append(q.parts, makePart(text, params...)) |
| 40 | return q |
| 41 | } |
| 42 | |
| 43 | // makePart creates a QueryPart, expanding any *Query parameters inline. |
| 44 | func makePart(text string, params ...any) QueryPart { |