* Previously all ID types needed to have the `isZero` function defined.
This was named after the UUID.isZero function but does not describe
the general case. Non-numeric is types will not be "zero," they will
be "empty." Renamed to `isEmpty` and implemented basic versions of
this for `int`, `string`, and `UUID`.
* Previously newly created records were not allowed to have ids set.
Fiber required them to be set in the database and the caller to
retrieve the newly generated ID from the newly created record. This is
not really a decision that Fiber should make in a general case. There
are valid reasons for both possibilities (creating the id in the
application code vs. creating the id in the database layer). As a
more general-purpose solution Fiber now leaves this to the caller.
If the caller provides an id value, Fiber will include it in the
INSERT statement. If the id is unset, Fiber will not include it at
all, allowing it to be generated in the database.
The Option type has two forms depending on the type of the wrapped value
(see https://nim-lang.org/docs/options.html#Option). We only supported
one of these previously. This commit adds support for the other type as
well.
Additionally, this fixes a compile error that was introduced into the
use of `isSome` in the generated code after Nim 1.0.
PostgreSQL uses a format similar to IS8601 but allows values expressed
with tenths or hundreths of seconds rather than just milliseconds.
`2020-01-01 12:34:98.3+00` as opposed to `2020-01-01 12:34:98.300+00`,
for example. The `times` module in the Nim stdlib supports only
milliseconds with exactly three digits. To bridge this gap we detect the
two unsupported cases and pad the fractional seconds out to millisecond
precision.