MCPcopy
hub / github.com/Masterminds/squirrel / join

Method join

expr.go:369–388  ·  view source on GitHub ↗
(sep, defaultExpr string)

Source from the content-addressed store, hash-verified

367type conj []Sqlizer
368
369func (c conj) join(sep, defaultExpr string) (sql string, args []interface{}, err error) {
370 if len(c) == 0 {
371 return defaultExpr, []interface{}{}, nil
372 }
373 var sqlParts []string
374 for _, sqlizer := range c {
375 partSQL, partArgs, err := nestedToSql(sqlizer)
376 if err != nil {
377 return "", nil, err
378 }
379 if partSQL != "" {
380 sqlParts = append(sqlParts, partSQL)
381 args = append(args, partArgs...)
382 }
383 }
384 if len(sqlParts) > 0 {
385 sql = fmt.Sprintf("(%s)", strings.Join(sqlParts, sep))
386 }
387 return
388}
389
390// And conjunction Sqlizers
391type And conj

Callers 2

ToSqlMethod · 0.80
ToSqlMethod · 0.80

Calls 2

nestedToSqlFunction · 0.85
JoinMethod · 0.80

Tested by

no test coverage detected