Skip to content

Commit b6d435e

Browse files
committed
add comment
1 parent 328146f commit b6d435e

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

lib/shared/businessKey-helper.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,25 @@ function capitalizeAfterLastDot(input: string): string {
4848
return beforeLastDot + afterLastDot.charAt(0).toUpperCase() + afterLastDot.slice(1) + 'Service';
4949
}
5050

51+
/**
52+
* Converts a template string with placeholders into a SQL-style
53+
* concatenation expression.
54+
*
55+
* @param template - A template string containing `${variable}` placeholders
56+
* and literal text (e.g. `"${ssn}-${age}"`).
57+
* @returns A SQL concatenation string where placeholders are converted to
58+
* column names, literals are wrapped in single quotes, parts are joined
59+
* with `||`, and the expression is aliased as `businessKey`
60+
* (e.g. `"ssn || '-' || age as businessKey"`).
61+
*
62+
* @example
63+
* convertTemplate("${ssn}-${age}")
64+
* // → "ssn || '-' || age as businessKey"
65+
*
66+
* @example
67+
* convertTemplate("${firstName} ${lastName}")
68+
* // → "firstName || ' ' || lastName as businessKey"
69+
*/
5170
function convertBusinessKeyToExpr(template: string): string {
5271
const parts = template.split(TEMPLATE_PART_SPLITTER);
5372

0 commit comments

Comments
 (0)