also finds "/* TEMPLATE_BEGIN" Run replaces any tempates in input SQL with values from context added via WithReplacements. args aren't used for replacements in the input SQL, but are needed to determine which placeholder number (e.g. $1, $2, $3, ...) we should start with to replace any template nam
(ctx context.Context, argPlaceholder, sql string, args []any)
| 115 | // argPlaceholder is the character to use as a placeholder like "$" in "$1" or |
| 116 | // "$2". This should be a "$" for Postgres, but a "?" for SQLite. |
| 117 | func (r *Replacer) Run(ctx context.Context, argPlaceholder, sql string, args []any) (string, []any) { |
| 118 | sql, namedArgs, err := r.RunSafely(ctx, argPlaceholder, sql, args) |
| 119 | if err != nil { |
| 120 | panic(err) |
| 121 | } |
| 122 | return sql, namedArgs |
| 123 | } |
| 124 | |
| 125 | // RunSafely is the same as Run, but returns an error in case of missing or |
| 126 | // extra templates. |