Document array of fragments?
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 8.7k
- Forks
- 374
- Avg merge
- 11d 16h
- Merged PRs (30d)
- 1
Description
Is an array of fragments missing in the README?
sql`${[sql`select 1`, sql`as result`]}`
I first saw this in use in this example:
https://github.com/porsager/postgres/issues/217#issuecomment-1156958623
${
Object.keys(rows[0]).map((x, i) =>
sql`${ i ? sql`,` : sql``}${ sql(x) } = excluded.${ sql(x) }`
)
}
For me it wasn't super obvious that you could do that, but it's useful! Maybe add it to https://github.com/porsager/postgres#quick-primer-on-interpolation, something like
| Interpolation syntax | Usage | Example |
|---|---|---|
${ sql`` } |
for keywords or sql fragments | await sql`SELECT * FROM users ${sql`order by age desc` }` |
${ sql(string) } |
for identifiers | await sql`SELECT * FROM ${sql('table_name')` |
${ sql([] or {}, ...) } |
for helpers | await sql`INSERT INTO users ${sql({ name: 'Peter'})}` |
${ 'somevalue' } |
for values | await sql`SELECT * FROM users WHERE age = ${42}` |
${ [sql``, sql``, ...] } |
for sql fragments | some short but still useful example? |
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in the README's Quick Primer on Interpolation section, which the issue links, and review the existing interpolation table and examples. Document that arrays of SQL fragments are supported, using a concise example based on the issue, then check that the Markdown renders correctly and the example is understandable.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, postgresql
- Domain
- databases, documentation
- Issue type
- Documentation
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100