join

fun List<QueryFragment>.join(separator: String, prefix: String = "", postfix: String = "", addParenthesis: Boolean = true): QueryFragment

Joins a list of fragments into one, working analogously to standard joinToString, but with parameter merging support.

Postfix and prefix are mainly applicable for org.octavius.data.builder.RawQueryBuilder. The preferred way to add clauses themselves is to use the appropriate builders.

  1. Safely merges parameter maps, throwing an error in case of key conflicts.

  2. Ignores empty fragments. If after filtering the list is empty, returns an empty QueryFragment (ignoring prefix and postfix to avoid generating e.g., an empty "WHERE ()").

  3. Wraps each single fragment in parentheses to preserve operator precedence.

Return

New, joined QueryFragment.

Parameters

separator

Character sequence separating fragments, e.g., " AND ".

prefix

Character sequence inserted at the beginning of the entire resulting string (e.g., "WHERE ").

postfix

Character sequence inserted at the end of the entire resulting string (e.g., ";").

addParenthesis

Whether to add parentheses around fragments - default true