Skip to main content

postgres_in_pattern

Function postgres_in_pattern 

Source
pub fn postgres_in_pattern(start_idx: usize, count: usize) -> String
Expand description

Get a PostgreSQL IN placeholder pattern. Returns patterns like “$1, $2, $3” for count=3 starting at start_idx=1.

The pattern is always returned as an owned String; for counts 1-10 with start_idx=1 it is copied from the pre-computed POSTGRES_IN_FROM_1 table, and generated dynamically otherwise.

Prefer write_postgres_in_pattern on hot paths: it writes the pattern directly into a caller-provided buffer and is allocation-free for the pre-computed range.