How can I pass a string and a list of strings for an sql statement?

2021-01-22 Thread dogwater
Reviving this old thread... I'm trying to create a query based on a dynamic number of parameters for an `WHERE ID IN (?, ?, ?)` statement. I was expecting that simply passing a string sequence of ID's into the sql statement would automatically parse this, but doesn't seem to. Is this above-refe

Best showcase of tests in Nim standard library?

2021-01-21 Thread dogwater
I'm learning more about best practices around writing tests in Nim. I noticed some modules e.g. `thttpclient.nim` are relatively sparse and inconsistent in how the tests are written. Which stdlib module has the best set of tests for a newcomer to study?

Current state of list comprehison in Nim

2021-01-21 Thread dogwater
Did you see the section in the "Nim for Python Programmers" wiki here:

Any new edition of the Nim in Action book in the making?

2021-01-21 Thread dogwater
I picked up Dom's book 2 weeks ago and helped me get up to speed on Nim quickly. Serves as a helpful reference where official documentation may be sparse, e.g. async/await, macros and templates. The contents are still very relevant imo.

code snippet review: truncate string while preserving words

2021-01-15 Thread dogwater
Thanks for the feedback and elegant improvement. Starting at `truncAt` index and making use of `Whitespace` avoids many unneeded iterations.

code snippet review: truncate string while preserving words

2021-01-14 Thread dogwater
What's the most efficient way to truncate a string to a given character count while preserving words? I implemented the below using tokenize(). But given that this will run on a dozens of elements to render a page, looking to minimize overhead. proc truncate*(s: string, truncAt: in