diff --git a/docs/docs.css b/docs/docs.css
index cc49d13..32af395 100644
--- a/docs/docs.css
+++ b/docs/docs.css
@@ -1,14 +1,16 @@
body {
padding: 30px 12.5%;
- font: 12pt/1.667 source-serif-pro, Georgia, serif;
+ font: 12pt/1.667 "Source Serif 4", Georgia, serif;
background: #fff;
color: #444;
text-size-adjust: none;
-webkit-text-size-adjust: none;
}
+
.logos {
margin-bottom: 15px;
}
+
.pg-logo {
padding-right: 10px;
}
@@ -17,6 +19,7 @@ body {
width: 100%;
overflow: hidden;
}
+
.testimonials {
width: 800%;
margin-top: 30px;
@@ -24,12 +27,15 @@ body {
animation-duration: 48s;
animation-iteration-count: infinite;
}
+
.testimonials:hover {
animation-play-state: paused;
}
+
.testimonials:hover .testimonial {
border-top: 2px solid #555;
}
+
.testimonial {
background: #def;
border-top: 2px solid #36e;
@@ -38,71 +44,93 @@ body {
float: left;
box-sizing: border-box;
}
+
.quote p {
margin-bottom: 0;
font-style: italic;
}
+
.quote p::before {
content: '“';
}
+
.quote p::after {
content: '”';
}
+
.attribution p {
margin-top: 0;
}
+
.attribution p::before {
content: "— ";
}
+
@keyframes carousel {
0% {
transform: translate(0, 0);
}
+
10.5% {
transform: translate(0, 0);
}
+
12.5% {
transform: translate(-12.5%, 0);
}
+
23% {
transform: translate(-12.5%, 0);
}
+
25% {
transform: translate(-25%, 0);
}
+
35.5% {
transform: translate(-25%, 0);
}
+
37.5% {
transform: translate(-37.5%, 0);
}
+
48% {
transform: translate(-37.5%, 0);
}
+
50% {
transform: translate(-50%, 0);
}
+
60.5% {
transform: translate(-50%, 0);
}
+
62.5% {
transform: translate(-62.5%, 0);
}
+
72.5% {
transform: translate(-62.5%, 0);
}
+
75% {
transform: translate(-75%, 0);
}
+
85.5% {
transform: translate(-75%, 0);
}
+
87.5% {
transform: translate(-87.5%, 0);
}
+
98% {
transform: translate(-87.5%, 0);
}
+
100% {
transform: translate(0, 0);
}
@@ -111,61 +139,85 @@ body {
h1 {
margin: 0 0 60px;
}
-h2, h3, h4, h5, h6 {
+
+h2,
+h3,
+h4,
+h5,
+h6 {
margin: 40px 0 20px;
border-bottom: 1px #ddd solid;
padding-bottom: 5px;
}
-h1, h2, h3, h4, h5, h6 {
+
+h1,
+h2,
+h3,
+h4,
+h5,
+h6 {
line-height: 1.1;
color: #000;
}
+
h5 {
border: none;
font-size: inherit;
font-style: italic;
}
+
h6 {
border: none;
font-size: inherit;
font-style: italic;
font-weight: normal;
}
+
a {
color: #36e;
text-decoration: none;
}
+
li {
margin-top: 0;
margin-bottom: 0;
}
+
p {
margin: 12px 0;
}
-code, pre {
- font: 11pt/1.5 source-code-pro, Menlo, Monaco, monospace;
+
+code,
+pre {
+ font: 11pt/1.5 "Source Code Pro", Menlo, Monaco, monospace;
font-weight: inherit;
background: #f4f4f4;
}
+
pre {
padding: 9px 12px;
margin: 15px 0 20px;
white-space: pre-wrap;
-
- overflow-wrap: anywhere; /* Chrome */
- word-break: break-word; /* Safari */
+
+ overflow-wrap: anywhere;
+ /* Chrome */
+ word-break: break-word;
+ /* Safari */
counter-reset: line-no;
}
+
pre .indent-line {
display: inline-block;
}
+
pre code {
background: transparent;
}
+
#monaco-overlay {
position: fixed;
- background: rgba(0,0,0,0.667);
+ background: rgba(0, 0, 0, 0.667);
top: 0;
left: 0;
right: 0;
@@ -173,6 +225,7 @@ pre code {
z-index: 10;
display: none;
}
+
#ts-editor {
position: fixed;
top: 10%;
@@ -181,30 +234,45 @@ pre code {
left: 10%;
background: #fff;
}
+
#closemonaco {
display: block;
position: fixed;
color: #fff;
- font: 50px source-code-pro;
+ font: 50px "Source Code Pro";
top: 10%;
left: 90%;
line-height: 0.45;
padding-left: 5px;
}
+
.runnable {
position: relative;
margin-top: 30px;
padding-top: 20px;
}
+
.sqlstuff {
border: 1px solid #eee;
padding: 5px;
}
-.sqltext, .sqlvalues, .sqlresult, .transactionlog, .console {
+
+.sqltext,
+.sqlvalues,
+.sqlresult,
+.transactionlog,
+.console {
position: relative;
margin: 0;
}
-.sqltext::before, .sqlvalues::before, .sqlresult::before, .transactionlog::before, .console::before, .openmonaco, .toggleimports {
+
+.sqltext::before,
+.sqlvalues::before,
+.sqlresult::before,
+.transactionlog::before,
+.console::before,
+.openmonaco,
+.toggleimports {
background: #444;
color: #fff;
position: absolute;
@@ -215,12 +283,15 @@ pre code {
display: inline-block;
padding: 0 7px;
}
+
.openmonaco {
/* these rules fix a Safari bug */
min-width: 110px;
text-align: center;
}
-.openmonaco, .toggleimports {
+
+.openmonaco,
+.toggleimports {
color: #36e;
border: 1px solid #36e;
background: #fff;
@@ -229,70 +300,90 @@ pre code {
border-radius: 10px;
padding: 0 10px;
}
+
.toggleimports {
right: auto;
left: 10px;
color: #999;
border: 1px solid #999;
}
+
.imports {
display: none;
border-bottom: 1px dotted #ccc;
padding-bottom: 10px;
margin-bottom: 9px;
}
-.sqltext, .language-sql {
+
+.sqltext,
+.language-sql {
background: #eeeeff;
}
+
.sqltext::before {
content: 'SQL';
}
+
.sqlvalues {
background: #ffeeff;
margin-top: 0;
}
+
.sqlvalues::before {
content: '+ $1, $2, ...';
}
+
.sqlresult {
background: #ffeedd;
}
+
.sqlresult::before {
content: '⟶ result';
}
-.sqltext + .sqlresult, .sqlvalues + .sqlresult {
+
+.sqltext+.sqlresult,
+.sqlvalues+.sqlresult {
margin: 15px 0 20px;
}
+
.transactionlog::before {
content: 'Transactions';
}
+
.console {
margin: 15px 0 20px;
}
+
.console::before {
content: 'Console';
}
+
.transactionid {
color: #aaa;
margin-bottom: 0;
padding: 0 0 0 12px;
background: none;
}
+
.transactionid code {
font-size: 9pt;
}
+
code {
display: inline-block;
padding: 0 2px;
}
-pre > code {
+
+pre>code {
display: unset;
padding: unset;
}
+
#content {
margin-left: 260px;
padding-left: 50px;
}
+
#outer-toc {
position: fixed;
line-height: 1.1;
@@ -303,6 +394,7 @@ pre > code {
top: 0;
padding: 30px 0;
}
+
#toc-toggle {
display: none;
position: fixed;
@@ -315,20 +407,24 @@ pre > code {
color: #fff;
z-index: 1001;
}
+
p {
max-width: 85%;
}
+
@media (max-width: 1280px) {
body {
padding-right: 2.5%;
padding-left: 2.5%;
}
}
+
@media (max-width: 900px) {
#content {
margin: 0;
padding: 0;
}
+
#outer-toc {
display: none;
background: rgba(255, 255, 255, 0.95);
@@ -337,37 +433,47 @@ p {
padding-right: 30px;
z-index: 1000;
}
+
#outer-toc.toc-shown {
display: block;
}
+
#toc-toggle {
display: block;
}
+
p {
max-width: none;
}
}
+
#toc ol {
list-style-type: none;
}
+
#toc li {
margin: 4px 0;
}
+
.toc-list {
padding-left: 20px;
}
-#toc > .toc-list {
+
+#toc>.toc-list {
position: relative;
overflow: hidden;
}
+
.toc-link {
display: inline-block;
padding: 5px 0;
}
+
.src-link {
float: right;
margin: 40px 0 0 30px;
}
+
.toc-link::before {
margin-top: -5px;
}
@@ -378,6 +484,7 @@ h1 .extra-vowels {
transition: 0.45s all;
opacity: 0;
}
+
h1 .extra-vowels.o {
transition-delay: 0.15s;
-}
+}
\ No newline at end of file
diff --git a/docs/docs.js b/docs/docs.js
index 0a7406e..041e322 100644
--- a/docs/docs.js
+++ b/docs/docs.js
@@ -116,7 +116,7 @@ document.addEventListener('click', function (e) {
commonOpts = {
minimap: { enabled: false },
scrollBeyondLastLine: false,
- fontFamily: 'source-code-pro',
+ fontFamily: 'Source Code Pro',
fontSize: 15,
theme: 'vs-dark',
automaticLayout: true, // resize with host
diff --git a/docs/index.html b/docs/index.html
index 04b94de..3925503 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -11,7 +11,9 @@
-
+
+
+
@@ -278,7 +280,7 @@
JOINs as nested JSON
"isLiving" : true
} ,
"authorId" : 1000 ,
- "createdAt" : "2022-05-19T10:34:48.274556+01:00"
+ "createdAt" : "2023-11-16T11:27:47.847734+00:00"
} ,
{
"id" : 1001 ,
@@ -299,7 +301,7 @@ JOINs as nested JSON
"isLiving" : true
} ,
"authorId" : 1000 ,
- "createdAt" : "2022-05-19T10:34:48.275816+01:00"
+ "createdAt" : "2023-11-16T11:27:47.848612+00:00"
} ,
{
"id" : 1002 ,
@@ -320,7 +322,7 @@ JOINs as nested JSON
"isLiving" : true
} ,
"authorId" : 1000 ,
- "createdAt" : "2022-05-19T10:34:48.276515+01:00"
+ "createdAt" : "2023-11-16T11:27:47.849159+00:00"
} ,
{
"id" : 1003 ,
@@ -337,7 +339,7 @@ JOINs as nested JSON
"isLiving" : true
} ,
"authorId" : 1001 ,
- "createdAt" : "2022-05-19T10:34:48.281966+01:00"
+ "createdAt" : "2023-11-16T11:27:47.854358+00:00"
} ,
{
"id" : 1004 ,
@@ -354,7 +356,7 @@ JOINs as nested JSON
"isLiving" : true
} ,
"authorId" : 1002 ,
- "createdAt" : "2022-05-19T10:34:48.283807+01:00"
+ "createdAt" : "2023-11-16T11:27:47.855953+00:00"
}
]
@@ -622,7 +624,7 @@ Import it
import type * as c from 'zapatos/custom' ;
The paths zapatos/db
and zapatos/generate
point to real folders in node_modules
. Although they look like file paths, zapatos/schema
and zapatos/custom
are actually the names of ambient modules declared in the generated files in your source tree: zapatos/schema.d.ts
and zapatos/custom/*.d.ts
.
User guide
-
+
sql
tagged template strings
Arbitrary queries are written using the tagged template function sql
, which returns SQLFragment
class instances.
The sql
function is generic , having two type variables. For example:
@@ -677,10 +679,10 @@ sql
tagged template stringsSELECT random()
[
{
- "random" : 0.2327662963714623
+ "random" : 0.7165549267636955
}
]
-0.2327662963714623
+0.7165549267636955
Interpolations
is never
because nothing needs to be interpolated in this query, and the RunResult
type says that the query will return one row comprising one numeric column, named random
. The random
TypeScript variable we initialize will of course be typed as a number
.
If you’re happy to have your types tied down a little less tightly, it also works to wholly omit the type variables in this particular query, falling back on their defaults:
@@ -820,7 +822,7 @@ Whereable
"id" : 1000 ,
"authorId" : 1000 ,
"title" : "Northern Lights" ,
- "createdAt" : "2022-05-19T09:34:48.275Z"
+ "createdAt" : "2023-11-16T11:27:47.848Z"
}
]
@@ -846,7 +848,7 @@ Whereable
"id" : 1000 ,
"authorId" : 1000 ,
"title" : "Northern Lights" ,
- "createdAt" : "2022-05-19T09:34:48.275Z"
+ "createdAt" : "2023-11-16T11:27:47.848Z"
}
]
@@ -872,7 +874,7 @@ Whereable
"id" : 1000 ,
"authorId" : 1000 ,
"title" : "Northern Lights" ,
- "createdAt" : "2022-05-19T09:34:48.275Z"
+ "createdAt" : "2023-11-16T11:27:47.848Z"
}
]
@@ -933,10 +935,10 @@ parent(columnName?: string):
SQLFragment
SQLFragment<RunResult>
class instances are what is returned by the sql
tagged template function — you’re unlikely ever to contruct them directly with new
. They take on the RunResult
type variable from the sql
template function that constructs them.
You can interpolate them into other sql
tagged template strings, or call/access the following properties on them:
-
+
prepared(name: string): this
The prepared
function causes a name
property to be added to the compiled SQL query object that’s passed to pg
, and this instructs Postgres to treat it as a prepared statement . You can specify a prepared statement name as the function’s argument, or let it default to "_zapatos_prepared_N"
(where N is a sequence number). This name appears in the Postgres logs.
-
+
async run(queryable: Queryable, force = false): Promise<RunResult>
The run
function compiles, executes, and returns the transformed result of the query represented by this SQLFragment
. The awaited
return value is typed according to the SQLFragment
’s RunResult
type variable.
Taking that one step at a time:
@@ -953,7 +955,7 @@ async
Examples of the run
function are scattered throughout this documentation.
The force
parameter is relevant only if this SQLFragment
has been marked as a no-op : at present, Zapatos does this automatically if you pass an empty array to insert
or upsert
. By default, the database will not be disturbed in such cases, but you can force a no-op query to actually be run against the database — perhaps for logging or triggering reasons — by setting force
to true
.
-
+
compile(): SQLQuery
The compile
function recursively transforms this SQLFragment
and its interpolated values into a SQLQuery
object ({ text: string; values: any[]; }
) that can be passed straight to the pg
module. It is called without arguments (the arguments it can take are for internal use).
For example:
@@ -971,7 +973,7 @@ compile(): SQLQuery
}
You may never need this function. Use it if and when you want to see the SQL that would be executed by the run
function, without in fact executing it.
-
+
When you call run
, the function stored in this property is applied to the QueryResult
object returned by pg
, in order to produce the result that the run
function ultimately returns.
By default, the QueryResult
’s rows
property (which is an array) is returned: that is, the default implementation is just qr => qr.rows
. However, the shortcut functions supply their own runResultTransform
implementations in order to match their declared RunResult
types.
@@ -987,7 +989,7 @@ Note that the RunResult
type variable on the sql
template function (in this case, Date
) must reflect the type of the transformed result, not what comes straight back from pg
(which in this case is roughly { rows: [{ now: Date }] }
).
If a SQLFragment
does not have run
called on it directly — for example, if it is instead interpolated into another SQLFragment
, or given as the value of the lateral
option to the select
shortcut — then the runResultTransform
function is never applied.
@@ -1013,7 +1015,7 @@ Manual joins using Postgres
"id" : 1000 ,
"authorId" : 1000 ,
"title" : "Northern Lights" ,
- "createdAt" : "2022-05-19T09:34:48.275Z" ,
+ "createdAt" : "2023-11-16T11:27:47.848Z" ,
"author" : {
"id" : 1000 ,
"name" : "Philip Pullman" ,
@@ -1024,7 +1026,7 @@ Manual joins using Postgres
"id" : 1001 ,
"authorId" : 1000 ,
"title" : "The Subtle Knife" ,
- "createdAt" : "2022-05-19T09:34:48.276Z" ,
+ "createdAt" : "2023-11-16T11:27:47.849Z" ,
"author" : {
"id" : 1000 ,
"name" : "Philip Pullman" ,
@@ -1035,7 +1037,7 @@ Manual joins using Postgres
"id" : 1002 ,
"authorId" : 1000 ,
"title" : "The Amber Spyglass" ,
- "createdAt" : "2022-05-19T09:34:48.277Z" ,
+ "createdAt" : "2023-11-16T11:27:47.849Z" ,
"author" : {
"id" : 1000 ,
"name" : "Philip Pullman" ,
@@ -1046,7 +1048,7 @@ Manual joins using Postgres
"id" : 1003 ,
"authorId" : 1001 ,
"title" : "The Curious Incident of the Dog in the Night-Time" ,
- "createdAt" : "2022-05-19T09:34:48.282Z" ,
+ "createdAt" : "2023-11-16T11:27:47.854Z" ,
"author" : {
"id" : 1001 ,
"name" : "Mark Haddon" ,
@@ -1057,7 +1059,7 @@ Manual joins using Postgres
"id" : 1004 ,
"authorId" : 1002 ,
"title" : "Holes" ,
- "createdAt" : "2022-05-19T09:34:48.284Z" ,
+ "createdAt" : "2023-11-16T11:27:47.856Z" ,
"author" : {
"id" : 1002 ,
"name" : "Louis Sachar" ,
@@ -1093,19 +1095,19 @@ Manual joins using Postgres
"id" : 1000 ,
"title" : "Northern Lights" ,
"authorId" : 1000 ,
- "createdAt" : "2022-05-19T10:34:48.274556+01:00"
+ "createdAt" : "2023-11-16T11:27:47.847734+00:00"
} ,
{
"id" : 1001 ,
"title" : "The Subtle Knife" ,
"authorId" : 1000 ,
- "createdAt" : "2022-05-19T10:34:48.275816+01:00"
+ "createdAt" : "2023-11-16T11:27:47.848612+00:00"
} ,
{
"id" : 1002 ,
"title" : "The Amber Spyglass" ,
"authorId" : 1000 ,
- "createdAt" : "2022-05-19T10:34:48.276515+01:00"
+ "createdAt" : "2023-11-16T11:27:47.849159+00:00"
}
]
} ,
@@ -1118,7 +1120,7 @@ Manual joins using Postgres
"id" : 1003 ,
"title" : "The Curious Incident of the Dog in the Night-Time" ,
"authorId" : 1001 ,
- "createdAt" : "2022-05-19T10:34:48.281966+01:00"
+ "createdAt" : "2023-11-16T11:27:47.854358+00:00"
}
]
} ,
@@ -1131,7 +1133,7 @@ Manual joins using Postgres
"id" : 1004 ,
"title" : "Holes" ,
"authorId" : 1002 ,
- "createdAt" : "2022-05-19T10:34:48.283807+01:00"
+ "createdAt" : "2023-11-16T11:27:47.855953+00:00"
}
]
}
@@ -1169,19 +1171,19 @@ Manual joins using Postgres
"id" : 1000 ,
"authorId" : 1000 ,
"title" : "Northern Lights" ,
- "createdAt" : "2022-05-19T10:34:48.274556+01:00"
+ "createdAt" : "2023-11-16T11:27:47.847734+00:00"
} ,
{
"id" : 1001 ,
"authorId" : 1000 ,
"title" : "The Subtle Knife" ,
- "createdAt" : "2022-05-19T10:34:48.275816+01:00"
+ "createdAt" : "2023-11-16T11:27:47.848612+00:00"
} ,
{
"id" : 1002 ,
"authorId" : 1000 ,
"title" : "The Amber Spyglass" ,
- "createdAt" : "2022-05-19T10:34:48.276515+01:00"
+ "createdAt" : "2023-11-16T11:27:47.849159+00:00"
}
]
} ,
@@ -1194,7 +1196,7 @@ Manual joins using Postgres
"id" : 1003 ,
"authorId" : 1001 ,
"title" : "The Curious Incident of the Dog in the Night-Time" ,
- "createdAt" : "2022-05-19T10:34:48.281966+01:00"
+ "createdAt" : "2023-11-16T11:27:47.854358+00:00"
}
]
} ,
@@ -1207,7 +1209,7 @@ Manual joins using Postgres
"id" : 1004 ,
"authorId" : 1002 ,
"title" : "Holes" ,
- "createdAt" : "2022-05-19T10:34:48.283807+01:00"
+ "createdAt" : "2023-11-16T11:27:47.855953+00:00"
}
]
} ,
@@ -1241,7 +1243,7 @@ Manual joins using Postgres
Shortcut functions and lateral joins
A key contribution of Zapatos is a set of simple shortcut functions that make everyday CRUD queries extremely easy to work with. Furthermore, the select
shortcut can be nested in order to generate LATERAL JOIN queries, resulting in arbitrarily complex nested JSON structures with inputs and outputs that are still fully and automatically typed.
The shortcut functions make heavy use of Postgres’ JSON support, and their return values are thus JSONSelectable
s rather than the plain Selectable
s you’d get back from a manual query.
-
+
insert
The insert
shortcut inserts one or more rows in a table, and returns them with any DEFAULT
or generated values filled in. It takes a Table
name and the corresponding Insertable
or Insertable[]
, and returns the corresponding JSONSelectable
or JSONSelectable[]
(subject to the options described below).
The optional options
argument has two keys.
@@ -1311,13 +1313,13 @@ insert
"id" : 1 ,
"title" : "A Brief History of Time" ,
"authorId" : 5 ,
- "createdAt" : "2022-05-19T10:35:03.505027+01:00"
+ "createdAt" : "2023-11-16T11:27:59.270781+00:00"
} ,
{
"id" : 2 ,
"title" : "My Brief History" ,
"authorId" : 5 ,
- "createdAt" : "2022-05-19T10:35:03.505027+01:00"
+ "createdAt" : "2023-11-16T11:27:59.270781+00:00"
}
]
INSERT INTO "tags" ("bookId", "tag")
@@ -1365,7 +1367,7 @@ insert
WHERE false
[ ]
-
+
update
The update
shortcut updates rows in the database. It takes a Table
name and a corresponding Updatable
and Whereable
in that order, matching their order in the raw SQL query .
It returns a JSONSelectable[]
, listing every column of every row affected (or a subset or superset of those columns, if you use the returning
and/or extras
options, which work just as described above for insert
).
@@ -1412,12 +1414,12 @@ update
[
{
"email" : "me@privacy.net" ,
- "lastFailedLogin" : "2022-05-19T10:35:04.877521+01:00" ,
+ "lastFailedLogin" : "2023-11-16T11:28:00.438215+00:00" ,
"consecutiveFailedLogins" : 1
}
]
-
+
upsert
The upsert
shortcut issues an INSERT ... ON CONFLICT ...
query. Like insert
, it takes a Table
name and a corresponding Insertable
or Insertable[]
.
It then takes, in addition, a column name (or an array thereof) or an appropriate unique index as the conflict target: the ‘arbiter index(es)’ on which a conflict is to be detected.
@@ -1560,7 +1562,7 @@ INSERT ... ON CONFLICT ... DO NOT
{
"code" : "XYE953ZVU767" ,
"$action" : "INSERT" ,
- "redeemedAt" : "2022-05-19T10:35:05.821625+01:00"
+ "redeemedAt" : "2023-11-16T11:28:01.184917+00:00"
}
INSERT INTO "usedVoucherCodes" ("code")
VALUES ($1 )
@@ -1625,7 +1627,7 @@ updateValues
"$action" : "UPDATE"
}
-
+
deletes
The deletes
shortcut, unsurprisingly, deletes rows from a table (delete
, unfortunately, is a JavaScript reserved word). It takes the table name and an appropriate Whereable
or SQLFragment
, and by default returns the deleted rows as a JSONSelectable
.
Again, you can narrow or broaden what’s returned with the returning
and extras
options, as documented above for insert
.
@@ -1642,7 +1644,7 @@ deletes
}
]
-
+
truncate
The truncate
shortcut truncates one or more tables. It takes a Table
name or a Table[]
name array, and (optionally) the options 'CONTINUE IDENTITY'
/'RESTART IDENTITY'
and/or 'RESTRICT'
/'CASCADE'
.
For instance:
@@ -1674,7 +1676,7 @@ truncate
We can then empty the database like so:
await db.truncate (allTables, 'CASCADE' ).run (pool);
-
+
select
, selectOne
, and selectExactlyOne
The select
shortcut function, in its basic form, takes a Table
name and some WHERE
conditions, and returns a SQLFragment<JSONSelectable[]>
. Those WHERE
conditions can be the symbol all
(meaning: no conditions), a SQLFragment
from a sql
template string, or the appropriate Whereable
for the target table (recall that a Whereable
can itself contain SQLFragment
values ).
selectOne
does the same, except that it gives us a SQLFragment<JSONSelectable | undefined>
, promising only a single object (or undefined
) when run.
@@ -1692,43 +1694,43 @@ select
, select
"id" : 1000 ,
"title" : "Northern Lights" ,
"authorId" : 1000 ,
- "createdAt" : "2022-05-19T10:34:48.274556+01:00"
+ "createdAt" : "2023-11-16T11:27:47.847734+00:00"
} ,
{
"id" : 1001 ,
"title" : "The Subtle Knife" ,
"authorId" : 1000 ,
- "createdAt" : "2022-05-19T10:34:48.275816+01:00"
+ "createdAt" : "2023-11-16T11:27:47.848612+00:00"
} ,
{
"id" : 1002 ,
"title" : "The Amber Spyglass" ,
"authorId" : 1000 ,
- "createdAt" : "2022-05-19T10:34:48.276515+01:00"
+ "createdAt" : "2023-11-16T11:27:47.849159+00:00"
} ,
{
"id" : 1003 ,
"title" : "The Curious Incident of the Dog in the Night-Time" ,
"authorId" : 1001 ,
- "createdAt" : "2022-05-19T10:34:48.281966+01:00"
+ "createdAt" : "2023-11-16T11:27:47.854358+00:00"
} ,
{
"id" : 1 ,
"title" : "A Brief History of Time" ,
"authorId" : 5 ,
- "createdAt" : "2022-05-19T10:35:03.505027+01:00"
+ "createdAt" : "2023-11-16T11:27:59.270781+00:00"
} ,
{
"id" : 2 ,
"title" : "My Brief History" ,
"authorId" : 5 ,
- "createdAt" : "2022-05-19T10:35:03.505027+01:00"
+ "createdAt" : "2023-11-16T11:27:59.270781+00:00"
} ,
{
"id" : 3 ,
"title" : "The Universe in a Nutshell" ,
"authorId" : 5 ,
- "createdAt" : "2022-05-19T10:35:03.509708+01:00"
+ "createdAt" : "2023-11-16T11:27:59.2759+00:00"
}
]
@@ -1746,19 +1748,19 @@ select
, select
"id" : 1000 ,
"title" : "Northern Lights" ,
"authorId" : 1000 ,
- "createdAt" : "2022-05-19T10:34:48.274556+01:00"
+ "createdAt" : "2023-11-16T11:27:47.847734+00:00"
} ,
{
"id" : 1001 ,
"title" : "The Subtle Knife" ,
"authorId" : 1000 ,
- "createdAt" : "2022-05-19T10:34:48.275816+01:00"
+ "createdAt" : "2023-11-16T11:27:47.848612+00:00"
} ,
{
"id" : 1002 ,
"title" : "The Amber Spyglass" ,
"authorId" : 1000 ,
- "createdAt" : "2022-05-19T10:34:48.276515+01:00"
+ "createdAt" : "2023-11-16T11:27:47.849159+00:00"
}
]
@@ -1812,7 +1814,7 @@ select
, select
"id" : 1003 ,
"title" : "The Curious Incident of the Dog in the Night-Time" ,
"authorId" : 1001 ,
- "createdAt" : "2022-05-19T10:34:48.281966+01:00"
+ "createdAt" : "2023-11-16T11:27:47.854358+00:00"
}
]
@@ -1835,7 +1837,7 @@ select
, select
"id" : 1003 ,
"title" : "The Curious Incident of the Dog in the Night-Time" ,
"authorId" : 1001 ,
- "createdAt" : "2022-05-19T10:34:48.281966+01:00"
+ "createdAt" : "2023-11-16T11:27:47.854358+00:00"
}
]
@@ -1857,7 +1859,7 @@ select
, select
"id" : 1 ,
"title" : "A Brief History of Time" ,
"authorId" : 5 ,
- "createdAt" : "2022-05-19T10:35:03.505027+01:00"
+ "createdAt" : "2023-11-16T11:27:59.270781+00:00"
}
]
@@ -1925,7 +1927,7 @@ order
, limit
and "id" : 1 ,
"title" : "A Brief History of Time" ,
"authorId" : 5 ,
- "createdAt" : "2022-05-19T10:35:03.505027+01:00"
+ "createdAt" : "2023-11-16T11:27:59.270781+00:00"
}
]
@@ -1945,7 +1947,7 @@ order
, limit
and "id" : 1 ,
"title" : "A Brief History of Time" ,
"authorId" : 5 ,
- "createdAt" : "2022-05-19T10:35:03.505027+01:00"
+ "createdAt" : "2023-11-16T11:27:59.270781+00:00"
}
The { limit: 1 }
option is now applied automatically. And the return type following await
needs no destructuring and is now, correctly, JSONSelectable | undefined
.
@@ -1998,7 +2000,7 @@ lateral
property maps
"isLiving" : true
} ,
"authorId" : 1000 ,
- "createdAt" : "2022-05-19T10:34:48.274556+01:00"
+ "createdAt" : "2023-11-16T11:27:47.847734+00:00"
} ,
{
"id" : 1001 ,
@@ -2019,7 +2021,7 @@ lateral
property maps
"isLiving" : true
} ,
"authorId" : 1000 ,
- "createdAt" : "2022-05-19T10:34:48.275816+01:00"
+ "createdAt" : "2023-11-16T11:27:47.848612+00:00"
} ,
{
"id" : 1002 ,
@@ -2040,7 +2042,7 @@ lateral
property maps
"isLiving" : true
} ,
"authorId" : 1000 ,
- "createdAt" : "2022-05-19T10:34:48.276515+01:00"
+ "createdAt" : "2023-11-16T11:27:47.849159+00:00"
} ,
{
"id" : 1003 ,
@@ -2057,7 +2059,7 @@ lateral
property maps
"isLiving" : true
} ,
"authorId" : 1001 ,
- "createdAt" : "2022-05-19T10:34:48.281966+01:00"
+ "createdAt" : "2023-11-16T11:27:47.854358+00:00"
} ,
{
"id" : 1 ,
@@ -2074,7 +2076,7 @@ lateral
property maps
"isLiving" : false
} ,
"authorId" : 5 ,
- "createdAt" : "2022-05-19T10:35:03.505027+01:00"
+ "createdAt" : "2023-11-16T11:27:59.270781+00:00"
} ,
{
"id" : 2 ,
@@ -2095,7 +2097,7 @@ lateral
property maps
"isLiving" : false
} ,
"authorId" : 5 ,
- "createdAt" : "2022-05-19T10:35:03.505027+01:00"
+ "createdAt" : "2023-11-16T11:27:59.270781+00:00"
} ,
{
"id" : 3 ,
@@ -2107,7 +2109,7 @@ lateral
property maps
"isLiving" : false
} ,
"authorId" : 5 ,
- "createdAt" : "2022-05-19T10:35:03.509708+01:00"
+ "createdAt" : "2023-11-16T11:27:59.2759+00:00"
}
]
@@ -2158,7 +2160,7 @@ lateral
property maps
] ,
"title" : "Northern Lights" ,
"authorId" : 1000 ,
- "createdAt" : "2022-05-19T10:34:48.274556+01:00"
+ "createdAt" : "2023-11-16T11:27:47.847734+00:00"
} ,
{
"id" : 1001 ,
@@ -2172,7 +2174,7 @@ lateral
property maps
] ,
"title" : "The Subtle Knife" ,
"authorId" : 1000 ,
- "createdAt" : "2022-05-19T10:34:48.275816+01:00"
+ "createdAt" : "2023-11-16T11:27:47.848612+00:00"
} ,
{
"id" : 1002 ,
@@ -2186,7 +2188,7 @@ lateral
property maps
] ,
"title" : "The Amber Spyglass" ,
"authorId" : 1000 ,
- "createdAt" : "2022-05-19T10:34:48.276515+01:00"
+ "createdAt" : "2023-11-16T11:27:47.849159+00:00"
}
] ,
"isLiving" : true
@@ -2204,7 +2206,7 @@ lateral
property maps
] ,
"title" : "The Curious Incident of the Dog in the Night-Time" ,
"authorId" : 1001 ,
- "createdAt" : "2022-05-19T10:34:48.281966+01:00"
+ "createdAt" : "2023-11-16T11:27:47.854358+00:00"
}
] ,
"isLiving" : true
@@ -2252,7 +2254,7 @@ lateral
property maps
] ,
"title" : "A Brief History of Time" ,
"authorId" : 5 ,
- "createdAt" : "2022-05-19T10:35:03.505027+01:00"
+ "createdAt" : "2023-11-16T11:27:59.270781+00:00"
} ,
{
"id" : 2 ,
@@ -2266,14 +2268,14 @@ lateral
property maps
] ,
"title" : "My Brief History" ,
"authorId" : 5 ,
- "createdAt" : "2022-05-19T10:35:03.505027+01:00"
+ "createdAt" : "2023-11-16T11:27:59.270781+00:00"
} ,
{
"id" : 3 ,
"tags" : [ ] ,
"title" : "The Universe in a Nutshell" ,
"authorId" : 5 ,
- "createdAt" : "2022-05-19T10:35:03.509708+01:00"
+ "createdAt" : "2023-11-16T11:27:59.2759+00:00"
}
] ,
"isLiving" : false
@@ -2750,43 +2752,43 @@ distinct
"id" : 2 ,
"title" : "My Brief History" ,
"authorId" : 5 ,
- "createdAt" : "2022-05-19T10:35:03.505027+01:00"
+ "createdAt" : "2023-11-16T11:27:59.270781+00:00"
} ,
{
- "id" : 3 ,
- "title" : "The Universe in a Nutshell" ,
+ "id" : 1000 ,
+ "title" : "Northern Lights" ,
+ "authorId" : 1000 ,
+ "createdAt" : "2023-11-16T11:27:47.847734+00:00"
+ } ,
+ {
+ "id" : 1 ,
+ "title" : "A Brief History of Time" ,
"authorId" : 5 ,
- "createdAt" : "2022-05-19T10:35:03.509708+01:00"
+ "createdAt" : "2023-11-16T11:27:59.270781+00:00"
} ,
{
"id" : 1002 ,
"title" : "The Amber Spyglass" ,
"authorId" : 1000 ,
- "createdAt" : "2022-05-19T10:34:48.276515+01:00"
- } ,
- {
- "id" : 1003 ,
- "title" : "The Curious Incident of the Dog in the Night-Time" ,
- "authorId" : 1001 ,
- "createdAt" : "2022-05-19T10:34:48.281966+01:00"
+ "createdAt" : "2023-11-16T11:27:47.849159+00:00"
} ,
{
- "id" : 1 ,
- "title" : "A Brief History of Time" ,
+ "id" : 3 ,
+ "title" : "The Universe in a Nutshell" ,
"authorId" : 5 ,
- "createdAt" : "2022-05-19T10:35:03.505027+01:00"
+ "createdAt" : "2023-11-16T11:27:59.2759+00:00"
} ,
{
"id" : 1001 ,
"title" : "The Subtle Knife" ,
"authorId" : 1000 ,
- "createdAt" : "2022-05-19T10:34:48.275816+01:00"
+ "createdAt" : "2023-11-16T11:27:47.848612+00:00"
} ,
{
- "id" : 1000 ,
- "title" : "Northern Lights" ,
- "authorId" : 1000 ,
- "createdAt" : "2022-05-19T10:34:48.274556+01:00"
+ "id" : 1003 ,
+ "title" : "The Curious Incident of the Dog in the Night-Time" ,
+ "authorId" : 1001 ,
+ "createdAt" : "2023-11-16T11:27:47.854358+00:00"
}
]
SELECT coalesce (jsonb_agg(result ), '[]' ) AS result
@@ -2798,43 +2800,43 @@ distinct
"id" : 1 ,
"title" : "A Brief History of Time" ,
"authorId" : 5 ,
- "createdAt" : "2022-05-19T10:35:03.505027+01:00"
+ "createdAt" : "2023-11-16T11:27:59.270781+00:00"
} ,
{
"id" : 2 ,
"title" : "My Brief History" ,
"authorId" : 5 ,
- "createdAt" : "2022-05-19T10:35:03.505027+01:00"
+ "createdAt" : "2023-11-16T11:27:59.270781+00:00"
} ,
{
"id" : 1000 ,
"title" : "Northern Lights" ,
"authorId" : 1000 ,
- "createdAt" : "2022-05-19T10:34:48.274556+01:00"
+ "createdAt" : "2023-11-16T11:27:47.847734+00:00"
} ,
{
"id" : 1002 ,
"title" : "The Amber Spyglass" ,
"authorId" : 1000 ,
- "createdAt" : "2022-05-19T10:34:48.276515+01:00"
+ "createdAt" : "2023-11-16T11:27:47.849159+00:00"
} ,
{
"id" : 1003 ,
"title" : "The Curious Incident of the Dog in the Night-Time" ,
"authorId" : 1001 ,
- "createdAt" : "2022-05-19T10:34:48.281966+01:00"
+ "createdAt" : "2023-11-16T11:27:47.854358+00:00"
} ,
{
"id" : 1001 ,
"title" : "The Subtle Knife" ,
"authorId" : 1000 ,
- "createdAt" : "2022-05-19T10:34:48.275816+01:00"
+ "createdAt" : "2023-11-16T11:27:47.848612+00:00"
} ,
{
"id" : 3 ,
"title" : "The Universe in a Nutshell" ,
"authorId" : 5 ,
- "createdAt" : "2022-05-19T10:35:03.509708+01:00"
+ "createdAt" : "2023-11-16T11:27:59.2759+00:00"
}
]
SELECT coalesce (jsonb_agg(result ), '[]' ) AS result
@@ -2846,43 +2848,43 @@ distinct
"id" : 1 ,
"title" : "A Brief History of Time" ,
"authorId" : 5 ,
- "createdAt" : "2022-05-19T10:35:03.505027+01:00"
+ "createdAt" : "2023-11-16T11:27:59.270781+00:00"
} ,
{
"id" : 2 ,
"title" : "My Brief History" ,
"authorId" : 5 ,
- "createdAt" : "2022-05-19T10:35:03.505027+01:00"
+ "createdAt" : "2023-11-16T11:27:59.270781+00:00"
} ,
{
"id" : 1000 ,
"title" : "Northern Lights" ,
"authorId" : 1000 ,
- "createdAt" : "2022-05-19T10:34:48.274556+01:00"
+ "createdAt" : "2023-11-16T11:27:47.847734+00:00"
} ,
{
"id" : 1002 ,
"title" : "The Amber Spyglass" ,
"authorId" : 1000 ,
- "createdAt" : "2022-05-19T10:34:48.276515+01:00"
+ "createdAt" : "2023-11-16T11:27:47.849159+00:00"
} ,
{
"id" : 1003 ,
"title" : "The Curious Incident of the Dog in the Night-Time" ,
"authorId" : 1001 ,
- "createdAt" : "2022-05-19T10:34:48.281966+01:00"
+ "createdAt" : "2023-11-16T11:27:47.854358+00:00"
} ,
{
"id" : 1001 ,
"title" : "The Subtle Knife" ,
"authorId" : 1000 ,
- "createdAt" : "2022-05-19T10:34:48.275816+01:00"
+ "createdAt" : "2023-11-16T11:27:47.848612+00:00"
} ,
{
"id" : 3 ,
"title" : "The Universe in a Nutshell" ,
"authorId" : 5 ,
- "createdAt" : "2022-05-19T10:35:03.509708+01:00"
+ "createdAt" : "2023-11-16T11:27:59.2759+00:00"
}
]
SELECT coalesce (jsonb_agg(result ), '[]' ) AS result
@@ -2894,43 +2896,43 @@ distinct
"id" : 1 ,
"title" : "A Brief History of Time" ,
"authorId" : 5 ,
- "createdAt" : "2022-05-19T10:35:03.505027+01:00"
+ "createdAt" : "2023-11-16T11:27:59.270781+00:00"
} ,
{
"id" : 2 ,
"title" : "My Brief History" ,
"authorId" : 5 ,
- "createdAt" : "2022-05-19T10:35:03.505027+01:00"
+ "createdAt" : "2023-11-16T11:27:59.270781+00:00"
} ,
{
"id" : 1000 ,
"title" : "Northern Lights" ,
"authorId" : 1000 ,
- "createdAt" : "2022-05-19T10:34:48.274556+01:00"
+ "createdAt" : "2023-11-16T11:27:47.847734+00:00"
} ,
{
"id" : 1002 ,
"title" : "The Amber Spyglass" ,
"authorId" : 1000 ,
- "createdAt" : "2022-05-19T10:34:48.276515+01:00"
+ "createdAt" : "2023-11-16T11:27:47.849159+00:00"
} ,
{
"id" : 1003 ,
"title" : "The Curious Incident of the Dog in the Night-Time" ,
"authorId" : 1001 ,
- "createdAt" : "2022-05-19T10:34:48.281966+01:00"
+ "createdAt" : "2023-11-16T11:27:47.854358+00:00"
} ,
{
"id" : 1001 ,
"title" : "The Subtle Knife" ,
"authorId" : 1000 ,
- "createdAt" : "2022-05-19T10:34:48.275816+01:00"
+ "createdAt" : "2023-11-16T11:27:47.848612+00:00"
} ,
{
"id" : 3 ,
"title" : "The Universe in a Nutshell" ,
"authorId" : 5 ,
- "createdAt" : "2022-05-19T10:35:03.509708+01:00"
+ "createdAt" : "2023-11-16T11:27:59.2759+00:00"
}
]
@@ -3048,7 +3050,7 @@ lock
}
]
-
+
count
, avg
, sum
, min
and max
The count
, avg
, sum
, min
and max
functions generate SELECT
queries that apply the relevant aggregate to matching rows, and so each return a SQLFragment<number>
.
They’re used in a very similar way to select
, like this:
@@ -3083,7 +3085,7 @@ JSONSelectable
d1: 2012-06-01T12:34:00.000Z,
d2: 2012-05-31T23:00:00.000Z,
d3: 2012-06-01T00:00:00.000Z,
- d4: null
+ d4: 2012-10-09T02:34:00.000Z
}
{
s1: '2012-06-01T12:34:00.000Z',
@@ -3151,7 +3153,35 @@ JSONSelectable
o: -0,
isLuxonDateTime: true
},
- dt3: null,
+ dt3: DateTime {
+ ts: 626637180000,
+ _zone: SystemZone {},
+ loc: Locale {
+ locale: 'en-GB',
+ numberingSystem: null,
+ outputCalendar: null,
+ intl: 'en-GB',
+ weekdaysCache: [Object],
+ monthsCache: [Object],
+ meridiemCache: null,
+ eraCache: {},
+ specifiedLocale: null,
+ fastNumbersCached: null
+ },
+ invalid: null,
+ weekData: null,
+ c: {
+ year: 1989,
+ month: 11,
+ day: 9,
+ hour: 17,
+ minute: 53,
+ second: 0,
+ millisecond: 0
+ },
+ o: -0,
+ isLuxonDateTime: true
+ },
alsoTsTz: '1989-11-09T17:53:00.000+00:00'
}
@@ -3265,16 +3295,10 @@ transaction
console .log (`Leave booked for:
Annabel – ${leaveBookedForAnnabel}
Brian – ${leaveBookedForBrian} ` );
-
Transaction 0
-
START TRANSACTION ISOLATION LEVEL SERIALIZABLE
Transaction 1
START TRANSACTION ISOLATION LEVEL SERIALIZABLE
Transaction 0
-
SELECT count ("shifts".* ) AS result
-FROM "shifts"
-WHERE ("day" = $1
- AND ("doctorId" != $2 ))
-
[ "2020-12-25" , 1 ]
+
START TRANSACTION ISOLATION LEVEL SERIALIZABLE
Transaction 1
SELECT count ("shifts".* ) AS result
FROM "shifts"
@@ -3282,12 +3306,10 @@ transaction
AND ("doctorId" != $2 ))
[ "2020-12-25" , 2 ]
Transaction 0
-
1
-
Transaction 0
-
DELETE FROM "shifts"
+SELECT count ("shifts".* ) AS result
+FROM "shifts"
WHERE ("day" = $1
- AND "doctorId" = $2 )
-RETURNING to_jsonb ("shifts".* ) AS result
+ AND ("doctorId" != $2 ))
[ "2020-12-25" , 1 ]
Transaction 1
1
@@ -3298,44 +3320,52 @@
transaction
RETURNING to_jsonb ("shifts".* ) AS result
[ "2020-12-25" , 2 ]
Transaction 0
+
1
+
Transaction 0
+
DELETE FROM "shifts"
+WHERE ("day" = $1
+ AND "doctorId" = $2 )
+RETURNING to_jsonb ("shifts".* ) AS result
+
[ "2020-12-25" , 1 ]
+
Transaction 1
[
{
"day" : "2020-12-25" ,
- "doctorId" : 1
+ "doctorId" : 2
}
]
-
Transaction 0
-
COMMIT
Transaction 1
+
COMMIT
+
Transaction 0
[
{
"day" : "2020-12-25" ,
- "doctorId" : 2
+ "doctorId" : 1
}
]
-
Transaction 1
+
Transaction 0
COMMIT
-
Transaction 1
+
Transaction 0
ROLLBACK
-
Transaction 1
-
Transaction rollback (code 40001) on attempt 1 of 5, retrying in 90ms
-
Transaction 1
+
Transaction 0
+
Transaction rollback (code 40001) on attempt 1 of 5, retrying in 75ms
+
Transaction 0
Retrying transaction, attempt 2 of 5
-
Transaction 1
+
Transaction 0
START TRANSACTION ISOLATION LEVEL SERIALIZABLE
-
Transaction 1
+
Transaction 0
SELECT count ("shifts".* ) AS result
FROM "shifts"
WHERE ("day" = $1
AND ("doctorId" != $2 ))
-
[ "2020-12-25" , 2 ]
-
Transaction 1
+
[ "2020-12-25" , 1 ]
+
Transaction 0
0
-
Transaction 1
+
Transaction 0
COMMIT
Leave booked for:
- Annabel – true
- Brian – false
+
Annabel – false
+
Brian – true
Expanding the results, we see that one of the requests is retried and then fails — as it must to retain one doctor on shift — thanks to the SERIALIZABLE
isolation. REPEATABLE READ
, which is one isolation level weaker, wouldn’t help here.
Transaction isolation shortcuts
@@ -3804,6 +3834,8 @@ Casting Parameters
to JSON
About Zapatos
Changes
This change list is not comprehensive. For a complete version history, please see the commit list .
+6.2
+Return type for certain embedded SQLFragments
now matches the null
actually returned (previously typed as undefined
). Fix for and
and or
types . Corrected package.json
key order. Exporting mapWithSeparator
.
6.0
Breaking change (if you use schemas) : Thanks to generous sponsorship from Seam , Zapatos now supports schemas properly, prefixing the schema to table and enum names as necessary in the generated types. If you make use of Postgres schemas outside of the default public
schema, you’ll need to add schema names in the appropriate places (TypeScript errors should show you where).
5.0
@@ -3937,7 +3969,7 @@ Alternatives
You may find this excellent overview of TypeScript SQL libraries useful.
Licence
This software is released under the MIT licence .
-Copyright © 2020 — 2022 George MacKerron
+Copyright © 2020 — 2023 George MacKerron
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/docs/zapatos-bundle.js b/docs/zapatos-bundle.js
index dcbad05..cffe487 100644
--- a/docs/zapatos-bundle.js
+++ b/docs/zapatos-bundle.js
@@ -1 +1 @@
-const zapatosBundle = {"custom/PgGeometry.d.ts":"/*\n** Please edit this file as needed **\nIt's been generated by Zapatos as a custom type definition placeholder, and won't be overwritten\n*/\n\ndeclare module 'zapatos/custom' {\n export type PgGeometry = any; // replace with your custom type or interface as desired\n}\n","custom/index.d.ts":"/*\n** DON'T EDIT THIS FILE **\nIt's been generated by Zapatos, and is liable to be overwritten\n\nZapatos: https://jawj.github.io/zapatos/\nCopyright (C) 2020 - 2022 George MacKerron\nReleased under the MIT licence: see LICENCE file\n*/\n\n// this empty declaration appears to fix relative imports in other custom type files\ndeclare module 'zapatos/custom' { }\n","schema.d.ts":"/*\n** DON'T EDIT THIS FILE **\nIt's been generated by Zapatos, and is liable to be overwritten\n\nZapatos: https://jawj.github.io/zapatos/\nCopyright (C) 2020 - 2022 George MacKerron\nReleased under the MIT licence: see LICENCE file\n*/\n\ndeclare module 'zapatos/schema' {\n\n import type * as db from 'zapatos/db';\n import type * as c from 'zapatos/custom';\n\n // got a type error on schemaVersionCanary below? update by running `npx zapatos`\n export interface schemaVersionCanary extends db.SchemaVersionCanary { version: 103 }\n\n\n /* === schema: public === */\n\n /* --- enums --- */\n\n export type appleEnvironment = 'PROD' | 'Sandbox';\n export namespace every {\n export type appleEnvironment = ['PROD', 'Sandbox'];\n }\n\n /* --- tables --- */\n\n /**\n * **appleTransactions**\n * - Table in database\n */\n export namespace appleTransactions {\n export type Table = 'appleTransactions';\n export interface Selectable {\n /**\n * **appleTransactions.environment**\n * - `appleEnvironment` in database\n * - `NOT NULL`, no default\n */\n environment: appleEnvironment;\n /**\n * **appleTransactions.originalTransactionId**\n * - `text` in database\n * - `NOT NULL`, no default\n */\n originalTransactionId: string;\n /**\n * **appleTransactions.accountId**\n * - `int4` in database\n * - `NOT NULL`, no default\n */\n accountId: number;\n /**\n * **appleTransactions.latestReceiptData**\n * - `text` in database\n * - Nullable, no default\n */\n latestReceiptData: string | null;\n }\n export interface JSONSelectable {\n /**\n * **appleTransactions.environment**\n * - `appleEnvironment` in database\n * - `NOT NULL`, no default\n */\n environment: appleEnvironment;\n /**\n * **appleTransactions.originalTransactionId**\n * - `text` in database\n * - `NOT NULL`, no default\n */\n originalTransactionId: string;\n /**\n * **appleTransactions.accountId**\n * - `int4` in database\n * - `NOT NULL`, no default\n */\n accountId: number;\n /**\n * **appleTransactions.latestReceiptData**\n * - `text` in database\n * - Nullable, no default\n */\n latestReceiptData: string | null;\n }\n export interface Whereable {\n /**\n * **appleTransactions.environment**\n * - `appleEnvironment` in database\n * - `NOT NULL`, no default\n */\n environment?: appleEnvironment | db.Parameter | db.SQLFragment | db.ParentColumn | db.SQLFragment | db.SQLFragment | db.ParentColumn>;\n /**\n * **appleTransactions.originalTransactionId**\n * - `text` in database\n * - `NOT NULL`, no default\n */\n originalTransactionId?: string | db.Parameter | db.SQLFragment | db.ParentColumn | db.SQLFragment | db.SQLFragment | db.ParentColumn>;\n /**\n * **appleTransactions.accountId**\n * - `int4` in database\n * - `NOT NULL`, no default\n */\n accountId?: number | db.Parameter | db.SQLFragment | db.ParentColumn | db.SQLFragment | db.SQLFragment | db.ParentColumn>;\n /**\n * **appleTransactions.latestReceiptData**\n * - `text` in database\n * - Nullable, no default\n */\n latestReceiptData?: string | db.Parameter | db.SQLFragment | db.ParentColumn | db.SQLFragment | db.SQLFragment | db.ParentColumn>;\n }\n export interface Insertable {\n /**\n * **appleTransactions.environment**\n * - `appleEnvironment` in database\n * - `NOT NULL`, no default\n */\n environment: appleEnvironment | db.Parameter | db.SQLFragment;\n /**\n * **appleTransactions.originalTransactionId**\n * - `text` in database\n * - `NOT NULL`, no default\n */\n originalTransactionId: string | db.Parameter | db.SQLFragment;\n /**\n * **appleTransactions.accountId**\n * - `int4` in database\n * - `NOT NULL`, no default\n */\n accountId: number | db.Parameter | db.SQLFragment;\n /**\n * **appleTransactions.latestReceiptData**\n * - `text` in database\n * - Nullable, no default\n */\n latestReceiptData?: string | db.Parameter | null | db.DefaultType | db.SQLFragment;\n }\n export interface Updatable {\n /**\n * **appleTransactions.environment**\n * - `appleEnvironment` in database\n * - `NOT NULL`, no default\n */\n environment?: appleEnvironment | db.Parameter | db.SQLFragment | db.SQLFragment | db.SQLFragment>;\n /**\n * **appleTransactions.originalTransactionId**\n * - `text` in database\n * - `NOT NULL`, no default\n */\n originalTransactionId?: string | db.Parameter | db.SQLFragment | db.SQLFragment | db.SQLFragment>;\n /**\n * **appleTransactions.accountId**\n * - `int4` in database\n * - `NOT NULL`, no default\n */\n accountId?: number | db.Parameter | db.SQLFragment | db.SQLFragment | db.SQLFragment>;\n /**\n * **appleTransactions.latestReceiptData**\n * - `text` in database\n * - Nullable, no default\n */\n latestReceiptData?: string | db.Parameter | null | db.DefaultType | db.SQLFragment | db.SQLFragment | null | db.DefaultType | db.SQLFragment>;\n }\n export type UniqueIndex = 'appleTransactionsPrimaryKey';\n export type Column = keyof Selectable;\n export type OnlyCols = Pick;\n export type SQLExpression = Table | db.ColumnNames | db.ColumnValues | Whereable | Column | db.ParentColumn | db.GenericSQLExpression;\n export type SQL = SQLExpression | SQLExpression[];\n }\n\n /**\n * **arrays**\n * - Table in database\n */\n export namespace arrays {\n export type Table = 'arrays';\n export interface Selectable {\n /**\n * **arrays.jsonValue**\n * - `jsonb` in database\n * - Nullable, no default\n */\n jsonValue: db.JSONValue | null;\n /**\n * **arrays.textArray**\n * - `_text` in database\n * - Nullable, no default\n */\n textArray: string[] | null;\n }\n export interface JSONSelectable {\n /**\n * **arrays.jsonValue**\n * - `jsonb` in database\n * - Nullable, no default\n */\n jsonValue: db.JSONValue | null;\n /**\n * **arrays.textArray**\n * - `_text` in database\n * - Nullable, no default\n */\n textArray: string[] | null;\n }\n export interface Whereable {\n /**\n * **arrays.jsonValue**\n * - `jsonb` in database\n * - Nullable, no default\n */\n jsonValue?: db.JSONValue | db.Parameter | db.SQLFragment | db.ParentColumn | db.SQLFragment | db.SQLFragment | db.ParentColumn>;\n /**\n * **arrays.textArray**\n * - `_text` in database\n * - Nullable, no default\n */\n textArray?: string[] | db.Parameter | db.SQLFragment | db.ParentColumn | db.SQLFragment | db.SQLFragment | db.ParentColumn>;\n }\n export interface Insertable {\n /**\n * **arrays.jsonValue**\n * - `jsonb` in database\n * - Nullable, no default\n */\n jsonValue?: db.JSONValue | db.Parameter | null | db.DefaultType | db.SQLFragment;\n /**\n * **arrays.textArray**\n * - `_text` in database\n * - Nullable, no default\n */\n textArray?: string[] | db.Parameter | null | db.DefaultType | db.SQLFragment;\n }\n export interface Updatable {\n /**\n * **arrays.jsonValue**\n * - `jsonb` in database\n * - Nullable, no default\n */\n jsonValue?: db.JSONValue | db.Parameter | null | db.DefaultType | db.SQLFragment | db.SQLFragment | null | db.DefaultType | db.SQLFragment>;\n /**\n * **arrays.textArray**\n * - `_text` in database\n * - Nullable, no default\n */\n textArray?: string[] | db.Parameter | null | db.DefaultType | db.SQLFragment | db.SQLFragment | null | db.DefaultType | db.SQLFragment>;\n }\n export type UniqueIndex = never;\n export type Column = keyof Selectable;\n export type OnlyCols = Pick;\n export type SQLExpression = Table | db.ColumnNames | db.ColumnValues | Whereable | Column | db.ParentColumn | db.GenericSQLExpression;\n export type SQL = SQLExpression | SQLExpression[];\n }\n\n /**\n * **authors**\n * - Table in database\n */\n export namespace authors {\n export type Table = 'authors';\n export interface Selectable {\n /**\n * **authors.id**\n * - `int4` in database\n * - `NOT NULL`, default: `nextval('authors_id_seq'::regclass)`\n */\n id: number;\n /**\n * **authors.name**\n * - `text` in database\n * - `NOT NULL`, no default\n */\n name: string;\n /**\n * **authors.isLiving**\n * - `bool` in database\n * - Nullable, no default\n */\n isLiving: boolean | null;\n }\n export interface JSONSelectable {\n /**\n * **authors.id**\n * - `int4` in database\n * - `NOT NULL`, default: `nextval('authors_id_seq'::regclass)`\n */\n id: number;\n /**\n * **authors.name**\n * - `text` in database\n * - `NOT NULL`, no default\n */\n name: string;\n /**\n * **authors.isLiving**\n * - `bool` in database\n * - Nullable, no default\n */\n isLiving: boolean | null;\n }\n export interface Whereable {\n /**\n * **authors.id**\n * - `int4` in database\n * - `NOT NULL`, default: `nextval('authors_id_seq'::regclass)`\n */\n id?: number | db.Parameter | db.SQLFragment | db.ParentColumn | db.SQLFragment | db.SQLFragment | db.ParentColumn>;\n /**\n * **authors.name**\n * - `text` in database\n * - `NOT NULL`, no default\n */\n name?: string | db.Parameter | db.SQLFragment | db.ParentColumn | db.SQLFragment | db.SQLFragment | db.ParentColumn>;\n /**\n * **authors.isLiving**\n * - `bool` in database\n * - Nullable, no default\n */\n isLiving?: boolean | db.Parameter | db.SQLFragment | db.ParentColumn | db.SQLFragment | db.SQLFragment | db.ParentColumn>;\n }\n export interface Insertable {\n /**\n * **authors.id**\n * - `int4` in database\n * - `NOT NULL`, default: `nextval('authors_id_seq'::regclass)`\n */\n id?: number | db.Parameter | db.DefaultType | db.SQLFragment;\n /**\n * **authors.name**\n * - `text` in database\n * - `NOT NULL`, no default\n */\n name: string | db.Parameter | db.SQLFragment;\n /**\n * **authors.isLiving**\n * - `bool` in database\n * - Nullable, no default\n */\n isLiving?: boolean | db.Parameter | null | db.DefaultType | db.SQLFragment;\n }\n export interface Updatable {\n /**\n * **authors.id**\n * - `int4` in database\n * - `NOT NULL`, default: `nextval('authors_id_seq'::regclass)`\n */\n id?: number | db.Parameter | db.DefaultType | db.SQLFragment | db.SQLFragment | db.DefaultType | db.SQLFragment>;\n /**\n * **authors.name**\n * - `text` in database\n * - `NOT NULL`, no default\n */\n name?: string | db.Parameter | db.SQLFragment | db.SQLFragment | db.SQLFragment>;\n /**\n * **authors.isLiving**\n * - `bool` in database\n * - Nullable, no default\n */\n isLiving?: boolean | db.Parameter | null | db.DefaultType | db.SQLFragment | db.SQLFragment | null | db.DefaultType | db.SQLFragment>;\n }\n export type UniqueIndex = 'authors_pkey';\n export type Column = keyof Selectable;\n export type OnlyCols = Pick;\n export type SQLExpression = Table | db.ColumnNames | db.ColumnValues | Whereable | Column | db.ParentColumn | db.GenericSQLExpression;\n export type SQL = SQLExpression | SQLExpression[];\n }\n\n /**\n * **bankAccounts**\n * - Table in database\n */\n export namespace bankAccounts {\n export type Table = 'bankAccounts';\n export interface Selectable {\n /**\n * **bankAccounts.id**\n * - `int4` in database\n * - `NOT NULL`, default: `nextval('\"bankAccounts_id_seq\"'::regclass)`\n */\n id: number;\n /**\n * **bankAccounts.balance**\n * - `int4` in database\n * - `NOT NULL`, default: `0`\n */\n balance: number;\n }\n export interface JSONSelectable {\n /**\n * **bankAccounts.id**\n * - `int4` in database\n * - `NOT NULL`, default: `nextval('\"bankAccounts_id_seq\"'::regclass)`\n */\n id: number;\n /**\n * **bankAccounts.balance**\n * - `int4` in database\n * - `NOT NULL`, default: `0`\n */\n balance: number;\n }\n export interface Whereable {\n /**\n * **bankAccounts.id**\n * - `int4` in database\n * - `NOT NULL`, default: `nextval('\"bankAccounts_id_seq\"'::regclass)`\n */\n id?: number | db.Parameter | db.SQLFragment | db.ParentColumn | db.SQLFragment | db.SQLFragment | db.ParentColumn>;\n /**\n * **bankAccounts.balance**\n * - `int4` in database\n * - `NOT NULL`, default: `0`\n */\n balance?: number | db.Parameter | db.SQLFragment | db.ParentColumn | db.SQLFragment | db.SQLFragment | db.ParentColumn>;\n }\n export interface Insertable {\n /**\n * **bankAccounts.id**\n * - `int4` in database\n * - `NOT NULL`, default: `nextval('\"bankAccounts_id_seq\"'::regclass)`\n */\n id?: number | db.Parameter | db.DefaultType | db.SQLFragment;\n /**\n * **bankAccounts.balance**\n * - `int4` in database\n * - `NOT NULL`, default: `0`\n */\n balance?: number | db.Parameter | db.DefaultType | db.SQLFragment;\n }\n export interface Updatable {\n /**\n * **bankAccounts.id**\n * - `int4` in database\n * - `NOT NULL`, default: `nextval('\"bankAccounts_id_seq\"'::regclass)`\n */\n id?: number | db.Parameter | db.DefaultType | db.SQLFragment | db.SQLFragment | db.DefaultType | db.SQLFragment>;\n /**\n * **bankAccounts.balance**\n * - `int4` in database\n * - `NOT NULL`, default: `0`\n */\n balance?: number | db.Parameter | db.DefaultType | db.SQLFragment | db.SQLFragment | db.DefaultType | db.SQLFragment>;\n }\n export type UniqueIndex = 'bankAccounts_pkey';\n export type Column = keyof Selectable;\n export type OnlyCols = Pick;\n export type SQLExpression = Table | db.ColumnNames | db.ColumnValues | Whereable | Column | db.ParentColumn | db.GenericSQLExpression;\n export type SQL = SQLExpression | SQLExpression[];\n }\n\n /**\n * **books**\n * - Table in database\n */\n export namespace books {\n export type Table = 'books';\n export interface Selectable {\n /**\n * **books.id**\n * - `int4` in database\n * - `NOT NULL`, default: `nextval('books_id_seq'::regclass)`\n */\n id: number;\n /**\n * **books.authorId**\n * - `int4` in database\n * - `NOT NULL`, no default\n */\n authorId: number;\n /**\n * **books.title**\n * - `text` in database\n * - Nullable, no default\n */\n title: string | null;\n /**\n * **books.createdAt**\n * - `timestamptz` in database\n * - `NOT NULL`, default: `now()`\n */\n createdAt: Date;\n }\n export interface JSONSelectable {\n /**\n * **books.id**\n * - `int4` in database\n * - `NOT NULL`, default: `nextval('books_id_seq'::regclass)`\n */\n id: number;\n /**\n * **books.authorId**\n * - `int4` in database\n * - `NOT NULL`, no default\n */\n authorId: number;\n /**\n * **books.title**\n * - `text` in database\n * - Nullable, no default\n */\n title: string | null;\n /**\n * **books.createdAt**\n * - `timestamptz` in database\n * - `NOT NULL`, default: `now()`\n */\n createdAt: db.TimestampTzString;\n }\n export interface Whereable {\n /**\n * **books.id**\n * - `int4` in database\n * - `NOT NULL`, default: `nextval('books_id_seq'::regclass)`\n */\n id?: number | db.Parameter | db.SQLFragment | db.ParentColumn | db.SQLFragment | db.SQLFragment | db.ParentColumn>;\n /**\n * **books.authorId**\n * - `int4` in database\n * - `NOT NULL`, no default\n */\n authorId?: number | db.Parameter | db.SQLFragment | db.ParentColumn | db.SQLFragment | db.SQLFragment | db.ParentColumn>;\n /**\n * **books.title**\n * - `text` in database\n * - Nullable, no default\n */\n title?: string | db.Parameter | db.SQLFragment | db.ParentColumn | db.SQLFragment | db.SQLFragment | db.ParentColumn>;\n /**\n * **books.createdAt**\n * - `timestamptz` in database\n * - `NOT NULL`, default: `now()`\n */\n createdAt?: (db.TimestampTzString | Date) | db.Parameter<(db.TimestampTzString | Date)> | db.SQLFragment | db.ParentColumn | db.SQLFragment | db.SQLFragment | db.ParentColumn>;\n }\n export interface Insertable {\n /**\n * **books.id**\n * - `int4` in database\n * - `NOT NULL`, default: `nextval('books_id_seq'::regclass)`\n */\n id?: number | db.Parameter | db.DefaultType | db.SQLFragment;\n /**\n * **books.authorId**\n * - `int4` in database\n * - `NOT NULL`, no default\n */\n authorId: number | db.Parameter | db.SQLFragment;\n /**\n * **books.title**\n * - `text` in database\n * - Nullable, no default\n */\n title?: string | db.Parameter | null | db.DefaultType | db.SQLFragment;\n /**\n * **books.createdAt**\n * - `timestamptz` in database\n * - `NOT NULL`, default: `now()`\n */\n createdAt?: (db.TimestampTzString | Date) | db.Parameter<(db.TimestampTzString | Date)> | db.DefaultType | db.SQLFragment;\n }\n export interface Updatable {\n /**\n * **books.id**\n * - `int4` in database\n * - `NOT NULL`, default: `nextval('books_id_seq'::regclass)`\n */\n id?: number | db.Parameter | db.DefaultType | db.SQLFragment | db.SQLFragment | db.DefaultType | db.SQLFragment>;\n /**\n * **books.authorId**\n * - `int4` in database\n * - `NOT NULL`, no default\n */\n authorId?: number | db.Parameter | db.SQLFragment | db.SQLFragment | db.SQLFragment>;\n /**\n * **books.title**\n * - `text` in database\n * - Nullable, no default\n */\n title?: string | db.Parameter | null | db.DefaultType | db.SQLFragment | db.SQLFragment | null | db.DefaultType | db.SQLFragment>;\n /**\n * **books.createdAt**\n * - `timestamptz` in database\n * - `NOT NULL`, default: `now()`\n */\n createdAt?: (db.TimestampTzString | Date) | db.Parameter<(db.TimestampTzString | Date)> | db.DefaultType | db.SQLFragment | db.SQLFragment | db.DefaultType | db.SQLFragment>;\n }\n export type UniqueIndex = 'books_pkey';\n export type Column = keyof Selectable;\n export type OnlyCols = Pick;\n export type SQLExpression = Table | db.ColumnNames | db.ColumnValues | Whereable | Column | db.ParentColumn | db.GenericSQLExpression;\n export type SQL = SQLExpression | SQLExpression[];\n }\n\n /**\n * **doctors**\n * - Table in database\n */\n export namespace doctors {\n export type Table = 'doctors';\n export interface Selectable {\n /**\n * **doctors.id**\n * - `int4` in database\n * - `NOT NULL`, default: `nextval('doctors_id_seq'::regclass)`\n */\n id: number;\n /**\n * **doctors.name**\n * - `text` in database\n * - `NOT NULL`, no default\n */\n name: string;\n }\n export interface JSONSelectable {\n /**\n * **doctors.id**\n * - `int4` in database\n * - `NOT NULL`, default: `nextval('doctors_id_seq'::regclass)`\n */\n id: number;\n /**\n * **doctors.name**\n * - `text` in database\n * - `NOT NULL`, no default\n */\n name: string;\n }\n export interface Whereable {\n /**\n * **doctors.id**\n * - `int4` in database\n * - `NOT NULL`, default: `nextval('doctors_id_seq'::regclass)`\n */\n id?: number | db.Parameter | db.SQLFragment | db.ParentColumn | db.SQLFragment | db.SQLFragment | db.ParentColumn>;\n /**\n * **doctors.name**\n * - `text` in database\n * - `NOT NULL`, no default\n */\n name?: string | db.Parameter | db.SQLFragment | db.ParentColumn | db.SQLFragment | db.SQLFragment | db.ParentColumn>;\n }\n export interface Insertable {\n /**\n * **doctors.id**\n * - `int4` in database\n * - `NOT NULL`, default: `nextval('doctors_id_seq'::regclass)`\n */\n id?: number | db.Parameter | db.DefaultType | db.SQLFragment;\n /**\n * **doctors.name**\n * - `text` in database\n * - `NOT NULL`, no default\n */\n name: string | db.Parameter | db.SQLFragment;\n }\n export interface Updatable {\n /**\n * **doctors.id**\n * - `int4` in database\n * - `NOT NULL`, default: `nextval('doctors_id_seq'::regclass)`\n */\n id?: number | db.Parameter | db.DefaultType | db.SQLFragment | db.SQLFragment | db.DefaultType | db.SQLFragment>;\n /**\n * **doctors.name**\n * - `text` in database\n * - `NOT NULL`, no default\n */\n name?: string | db.Parameter | db.SQLFragment | db.SQLFragment | db.SQLFragment>;\n }\n export type UniqueIndex = 'doctors_pkey';\n export type Column = keyof Selectable;\n export type OnlyCols = Pick;\n export type SQLExpression = Table | db.ColumnNames | db.ColumnValues | Whereable | Column | db.ParentColumn | db.GenericSQLExpression;\n export type SQL = SQLExpression | SQLExpression[];\n }\n\n /**\n * **emailAuthentication**\n * - Table in database\n */\n export namespace emailAuthentication {\n export type Table = 'emailAuthentication';\n export interface Selectable {\n /**\n * **emailAuthentication.email**\n * - `text` in database\n * - `NOT NULL`, no default\n */\n email: string;\n /**\n * **emailAuthentication.consecutiveFailedLogins**\n * - `int4` in database\n * - `NOT NULL`, default: `0`\n */\n consecutiveFailedLogins: number;\n /**\n * **emailAuthentication.lastFailedLogin**\n * - `timestamptz` in database\n * - Nullable, no default\n */\n lastFailedLogin: Date | null;\n }\n export interface JSONSelectable {\n /**\n * **emailAuthentication.email**\n * - `text` in database\n * - `NOT NULL`, no default\n */\n email: string;\n /**\n * **emailAuthentication.consecutiveFailedLogins**\n * - `int4` in database\n * - `NOT NULL`, default: `0`\n */\n consecutiveFailedLogins: number;\n /**\n * **emailAuthentication.lastFailedLogin**\n * - `timestamptz` in database\n * - Nullable, no default\n */\n lastFailedLogin: db.TimestampTzString | null;\n }\n export interface Whereable {\n /**\n * **emailAuthentication.email**\n * - `text` in database\n * - `NOT NULL`, no default\n */\n email?: string | db.Parameter | db.SQLFragment | db.ParentColumn | db.SQLFragment | db.SQLFragment | db.ParentColumn>;\n /**\n * **emailAuthentication.consecutiveFailedLogins**\n * - `int4` in database\n * - `NOT NULL`, default: `0`\n */\n consecutiveFailedLogins?: number | db.Parameter | db.SQLFragment | db.ParentColumn | db.SQLFragment | db.SQLFragment | db.ParentColumn>;\n /**\n * **emailAuthentication.lastFailedLogin**\n * - `timestamptz` in database\n * - Nullable, no default\n */\n lastFailedLogin?: (db.TimestampTzString | Date) | db.Parameter<(db.TimestampTzString | Date)> | db.SQLFragment | db.ParentColumn | db.SQLFragment | db.SQLFragment | db.ParentColumn>;\n }\n export interface Insertable {\n /**\n * **emailAuthentication.email**\n * - `text` in database\n * - `NOT NULL`, no default\n */\n email: string | db.Parameter | db.SQLFragment;\n /**\n * **emailAuthentication.consecutiveFailedLogins**\n * - `int4` in database\n * - `NOT NULL`, default: `0`\n */\n consecutiveFailedLogins?: number | db.Parameter | db.DefaultType | db.SQLFragment;\n /**\n * **emailAuthentication.lastFailedLogin**\n * - `timestamptz` in database\n * - Nullable, no default\n */\n lastFailedLogin?: (db.TimestampTzString | Date) | db.Parameter<(db.TimestampTzString | Date)> | null | db.DefaultType | db.SQLFragment;\n }\n export interface Updatable {\n /**\n * **emailAuthentication.email**\n * - `text` in database\n * - `NOT NULL`, no default\n */\n email?: string | db.Parameter | db.SQLFragment | db.SQLFragment | db.SQLFragment>;\n /**\n * **emailAuthentication.consecutiveFailedLogins**\n * - `int4` in database\n * - `NOT NULL`, default: `0`\n */\n consecutiveFailedLogins?: number | db.Parameter | db.DefaultType | db.SQLFragment | db.SQLFragment | db.DefaultType | db.SQLFragment>;\n /**\n * **emailAuthentication.lastFailedLogin**\n * - `timestamptz` in database\n * - Nullable, no default\n */\n lastFailedLogin?: (db.TimestampTzString | Date) | db.Parameter<(db.TimestampTzString | Date)> | null | db.DefaultType | db.SQLFragment | db.SQLFragment | null | db.DefaultType | db.SQLFragment>;\n }\n export type UniqueIndex = 'emailAuthentication_pkey';\n export type Column = keyof Selectable;\n export type OnlyCols = Pick;\n export type SQLExpression = Table | db.ColumnNames | db.ColumnValues | Whereable | Column | db.ParentColumn | db.GenericSQLExpression;\n export type SQL = SQLExpression | SQLExpression[];\n }\n\n /**\n * **employees**\n * - Table in database\n */\n export namespace employees {\n export type Table = 'employees';\n export interface Selectable {\n /**\n * **employees.id**\n * - `int4` in database\n * - `NOT NULL`, default: `nextval('employees_id_seq'::regclass)`\n */\n id: number;\n /**\n * **employees.name**\n * - `text` in database\n * - `NOT NULL`, no default\n */\n name: string;\n /**\n * **employees.managerId**\n * - `int4` in database\n * - Nullable, no default\n */\n managerId: number | null;\n }\n export interface JSONSelectable {\n /**\n * **employees.id**\n * - `int4` in database\n * - `NOT NULL`, default: `nextval('employees_id_seq'::regclass)`\n */\n id: number;\n /**\n * **employees.name**\n * - `text` in database\n * - `NOT NULL`, no default\n */\n name: string;\n /**\n * **employees.managerId**\n * - `int4` in database\n * - Nullable, no default\n */\n managerId: number | null;\n }\n export interface Whereable {\n /**\n * **employees.id**\n * - `int4` in database\n * - `NOT NULL`, default: `nextval('employees_id_seq'::regclass)`\n */\n id?: number | db.Parameter | db.SQLFragment | db.ParentColumn | db.SQLFragment | db.SQLFragment | db.ParentColumn>;\n /**\n * **employees.name**\n * - `text` in database\n * - `NOT NULL`, no default\n */\n name?: string | db.Parameter | db.SQLFragment | db.ParentColumn | db.SQLFragment | db.SQLFragment | db.ParentColumn>;\n /**\n * **employees.managerId**\n * - `int4` in database\n * - Nullable, no default\n */\n managerId?: number | db.Parameter | db.SQLFragment | db.ParentColumn | db.SQLFragment | db.SQLFragment | db.ParentColumn>;\n }\n export interface Insertable {\n /**\n * **employees.id**\n * - `int4` in database\n * - `NOT NULL`, default: `nextval('employees_id_seq'::regclass)`\n */\n id?: number | db.Parameter | db.DefaultType | db.SQLFragment;\n /**\n * **employees.name**\n * - `text` in database\n * - `NOT NULL`, no default\n */\n name: string | db.Parameter | db.SQLFragment;\n /**\n * **employees.managerId**\n * - `int4` in database\n * - Nullable, no default\n */\n managerId?: number | db.Parameter | null | db.DefaultType | db.SQLFragment;\n }\n export interface Updatable {\n /**\n * **employees.id**\n * - `int4` in database\n * - `NOT NULL`, default: `nextval('employees_id_seq'::regclass)`\n */\n id?: number | db.Parameter | db.DefaultType | db.SQLFragment | db.SQLFragment | db.DefaultType | db.SQLFragment>;\n /**\n * **employees.name**\n * - `text` in database\n * - `NOT NULL`, no default\n */\n name?: string | db.Parameter | db.SQLFragment | db.SQLFragment | db.SQLFragment>;\n /**\n * **employees.managerId**\n * - `int4` in database\n * - Nullable, no default\n */\n managerId?: number | db.Parameter | null | db.DefaultType | db.SQLFragment | db.SQLFragment | null | db.DefaultType | db.SQLFragment>;\n }\n export type UniqueIndex = 'employees_pkey';\n export type Column = keyof Selectable;\n export type OnlyCols = Pick;\n export type SQLExpression = Table | db.ColumnNames | db.ColumnValues | Whereable | Column | db.ParentColumn | db.GenericSQLExpression;\n export type SQL = SQLExpression | SQLExpression[];\n }\n\n /**\n * **nameCounts**\n * - Table in database\n */\n export namespace nameCounts {\n export type Table = 'nameCounts';\n export interface Selectable {\n /**\n * **nameCounts.name**\n * - `text` in database\n * - `NOT NULL`, no default\n */\n name: string;\n /**\n * **nameCounts.count**\n * - `int4` in database\n * - `NOT NULL`, no default\n */\n count: number;\n }\n export interface JSONSelectable {\n /**\n * **nameCounts.name**\n * - `text` in database\n * - `NOT NULL`, no default\n */\n name: string;\n /**\n * **nameCounts.count**\n * - `int4` in database\n * - `NOT NULL`, no default\n */\n count: number;\n }\n export interface Whereable {\n /**\n * **nameCounts.name**\n * - `text` in database\n * - `NOT NULL`, no default\n */\n name?: string | db.Parameter | db.SQLFragment | db.ParentColumn | db.SQLFragment | db.SQLFragment | db.ParentColumn>;\n /**\n * **nameCounts.count**\n * - `int4` in database\n * - `NOT NULL`, no default\n */\n count?: number | db.Parameter | db.SQLFragment | db.ParentColumn | db.SQLFragment | db.SQLFragment | db.ParentColumn>;\n }\n export interface Insertable {\n /**\n * **nameCounts.name**\n * - `text` in database\n * - `NOT NULL`, no default\n */\n name: string | db.Parameter | db.SQLFragment;\n /**\n * **nameCounts.count**\n * - `int4` in database\n * - `NOT NULL`, no default\n */\n count: number | db.Parameter | db.SQLFragment;\n }\n export interface Updatable {\n /**\n * **nameCounts.name**\n * - `text` in database\n * - `NOT NULL`, no default\n */\n name?: string | db.Parameter | db.SQLFragment | db.SQLFragment | db.SQLFragment>;\n /**\n * **nameCounts.count**\n * - `int4` in database\n * - `NOT NULL`, no default\n */\n count?: number | db.Parameter | db.SQLFragment | db.SQLFragment | db.SQLFragment>;\n }\n export type UniqueIndex = 'nameCounts_pkey';\n export type Column = keyof Selectable;\n export type OnlyCols = Pick;\n export type SQLExpression = Table | db.ColumnNames | db.ColumnValues | Whereable | Column | db.ParentColumn | db.GenericSQLExpression;\n export type SQL = SQLExpression | SQLExpression[];\n }\n\n /**\n * **photos**\n * - Table in database\n */\n export namespace photos {\n export type Table = 'photos';\n export interface Selectable {\n /**\n * **photos.photoId**\n * - `int4` in database\n * - `NOT NULL`, identity column\n */\n photoId: number;\n /**\n * **photos.url**\n * - `text` in database\n * - `NOT NULL`, no default\n */\n url: string;\n }\n export interface JSONSelectable {\n /**\n * **photos.photoId**\n * - `int4` in database\n * - `NOT NULL`, identity column\n */\n photoId: number;\n /**\n * **photos.url**\n * - `text` in database\n * - `NOT NULL`, no default\n */\n url: string;\n }\n export interface Whereable {\n /**\n * **photos.photoId**\n * - `int4` in database\n * - `NOT NULL`, identity column\n */\n photoId?: number | db.Parameter | db.SQLFragment | db.ParentColumn | db.SQLFragment | db.SQLFragment | db.ParentColumn>;\n /**\n * **photos.url**\n * - `text` in database\n * - `NOT NULL`, no default\n */\n url?: string | db.Parameter | db.SQLFragment | db.ParentColumn | db.SQLFragment | db.SQLFragment | db.ParentColumn>;\n }\n export interface Insertable {\n /**\n * **photos.photoId**\n * - `int4` in database\n * - `NOT NULL`, identity column\n */\n photoId?: number | db.Parameter | db.DefaultType | db.SQLFragment;\n /**\n * **photos.url**\n * - `text` in database\n * - `NOT NULL`, no default\n */\n url: string | db.Parameter | db.SQLFragment;\n }\n export interface Updatable {\n /**\n * **photos.photoId**\n * - `int4` in database\n * - `NOT NULL`, identity column\n */\n photoId?: number | db.Parameter | db.DefaultType | db.SQLFragment | db.SQLFragment | db.DefaultType | db.SQLFragment>;\n /**\n * **photos.url**\n * - `text` in database\n * - `NOT NULL`, no default\n */\n url?: string | db.Parameter | db.SQLFragment | db.SQLFragment | db.SQLFragment>;\n }\n export type UniqueIndex = 'photos_pkey';\n export type Column = keyof Selectable;\n export type OnlyCols = Pick;\n export type SQLExpression = Table | db.ColumnNames | db.ColumnValues | Whereable | Column | db.ParentColumn | db.GenericSQLExpression;\n export type SQL = SQLExpression | SQLExpression[];\n }\n\n /**\n * **shifts**\n * - Table in database\n */\n export namespace shifts {\n export type Table = 'shifts';\n export interface Selectable {\n /**\n * **shifts.day**\n * - `date` in database\n * - `NOT NULL`, no default\n */\n day: Date;\n /**\n * **shifts.doctorId**\n * - `int4` in database\n * - `NOT NULL`, no default\n */\n doctorId: number;\n }\n export interface JSONSelectable {\n /**\n * **shifts.day**\n * - `date` in database\n * - `NOT NULL`, no default\n */\n day: db.DateString;\n /**\n * **shifts.doctorId**\n * - `int4` in database\n * - `NOT NULL`, no default\n */\n doctorId: number;\n }\n export interface Whereable {\n /**\n * **shifts.day**\n * - `date` in database\n * - `NOT NULL`, no default\n */\n day?: (db.DateString | Date) | db.Parameter<(db.DateString | Date)> | db.SQLFragment | db.ParentColumn | db.SQLFragment | db.SQLFragment | db.ParentColumn>;\n /**\n * **shifts.doctorId**\n * - `int4` in database\n * - `NOT NULL`, no default\n */\n doctorId?: number | db.Parameter | db.SQLFragment | db.ParentColumn | db.SQLFragment | db.SQLFragment | db.ParentColumn>;\n }\n export interface Insertable {\n /**\n * **shifts.day**\n * - `date` in database\n * - `NOT NULL`, no default\n */\n day: (db.DateString | Date) | db.Parameter<(db.DateString | Date)> | db.SQLFragment;\n /**\n * **shifts.doctorId**\n * - `int4` in database\n * - `NOT NULL`, no default\n */\n doctorId: number | db.Parameter | db.SQLFragment;\n }\n export interface Updatable {\n /**\n * **shifts.day**\n * - `date` in database\n * - `NOT NULL`, no default\n */\n day?: (db.DateString | Date) | db.Parameter<(db.DateString | Date)> | db.SQLFragment | db.SQLFragment | db.SQLFragment>;\n /**\n * **shifts.doctorId**\n * - `int4` in database\n * - `NOT NULL`, no default\n */\n doctorId?: number | db.Parameter | db.SQLFragment | db.SQLFragment | db.SQLFragment>;\n }\n export type UniqueIndex = 'shifts_pkey';\n export type Column = keyof Selectable;\n export type OnlyCols = Pick;\n export type SQLExpression = Table | db.ColumnNames | db.ColumnValues | Whereable | Column | db.ParentColumn | db.GenericSQLExpression;\n export type SQL = SQLExpression | SQLExpression[];\n }\n\n /**\n * **stores**\n * - Table in database\n */\n export namespace stores {\n export type Table = 'stores';\n export interface Selectable {\n /**\n * **stores.id**\n * - `int4` in database\n * - `NOT NULL`, default: `nextval('stores_id_seq'::regclass)`\n */\n id: number;\n /**\n * **stores.name**\n * - `text` in database\n * - `NOT NULL`, no default\n */\n name: string;\n /**\n * **stores.geom**\n * - `geometry` in database\n * - `NOT NULL`, no default\n */\n geom: c.PgGeometry;\n }\n export interface JSONSelectable {\n /**\n * **stores.id**\n * - `int4` in database\n * - `NOT NULL`, default: `nextval('stores_id_seq'::regclass)`\n */\n id: number;\n /**\n * **stores.name**\n * - `text` in database\n * - `NOT NULL`, no default\n */\n name: string;\n /**\n * **stores.geom**\n * - `geometry` in database\n * - `NOT NULL`, no default\n */\n geom: c.PgGeometry;\n }\n export interface Whereable {\n /**\n * **stores.id**\n * - `int4` in database\n * - `NOT NULL`, default: `nextval('stores_id_seq'::regclass)`\n */\n id?: number | db.Parameter | db.SQLFragment | db.ParentColumn | db.SQLFragment | db.SQLFragment | db.ParentColumn>;\n /**\n * **stores.name**\n * - `text` in database\n * - `NOT NULL`, no default\n */\n name?: string | db.Parameter | db.SQLFragment | db.ParentColumn | db.SQLFragment | db.SQLFragment | db.ParentColumn>;\n /**\n * **stores.geom**\n * - `geometry` in database\n * - `NOT NULL`, no default\n */\n geom?: c.PgGeometry | db.Parameter | db.SQLFragment | db.ParentColumn | db.SQLFragment | db.SQLFragment | db.ParentColumn>;\n }\n export interface Insertable {\n /**\n * **stores.id**\n * - `int4` in database\n * - `NOT NULL`, default: `nextval('stores_id_seq'::regclass)`\n */\n id?: number | db.Parameter | db.DefaultType | db.SQLFragment;\n /**\n * **stores.name**\n * - `text` in database\n * - `NOT NULL`, no default\n */\n name: string | db.Parameter | db.SQLFragment;\n /**\n * **stores.geom**\n * - `geometry` in database\n * - `NOT NULL`, no default\n */\n geom: c.PgGeometry | db.Parameter | db.SQLFragment;\n }\n export interface Updatable {\n /**\n * **stores.id**\n * - `int4` in database\n * - `NOT NULL`, default: `nextval('stores_id_seq'::regclass)`\n */\n id?: number | db.Parameter | db.DefaultType | db.SQLFragment | db.SQLFragment | db.DefaultType | db.SQLFragment>;\n /**\n * **stores.name**\n * - `text` in database\n * - `NOT NULL`, no default\n */\n name?: string | db.Parameter | db.SQLFragment | db.SQLFragment | db.SQLFragment>;\n /**\n * **stores.geom**\n * - `geometry` in database\n * - `NOT NULL`, no default\n */\n geom?: c.PgGeometry | db.Parameter | db.SQLFragment | db.SQLFragment | db.SQLFragment>;\n }\n export type UniqueIndex = 'stores_pkey';\n export type Column = keyof Selectable;\n export type OnlyCols = Pick;\n export type SQLExpression = Table | db.ColumnNames | db.ColumnValues | Whereable | Column | db.ParentColumn | db.GenericSQLExpression;\n export type SQL = SQLExpression | SQLExpression[];\n }\n\n /**\n * **subjectPhotos**\n * - Table in database\n */\n export namespace subjectPhotos {\n export type Table = 'subjectPhotos';\n export interface Selectable {\n /**\n * **subjectPhotos.subjectId**\n * - `int4` in database\n * - `NOT NULL`, no default\n */\n subjectId: number;\n /**\n * **subjectPhotos.photoId**\n * - `int4` in database\n * - `NOT NULL`, no default\n */\n photoId: number;\n }\n export interface JSONSelectable {\n /**\n * **subjectPhotos.subjectId**\n * - `int4` in database\n * - `NOT NULL`, no default\n */\n subjectId: number;\n /**\n * **subjectPhotos.photoId**\n * - `int4` in database\n * - `NOT NULL`, no default\n */\n photoId: number;\n }\n export interface Whereable {\n /**\n * **subjectPhotos.subjectId**\n * - `int4` in database\n * - `NOT NULL`, no default\n */\n subjectId?: number | db.Parameter | db.SQLFragment | db.ParentColumn | db.SQLFragment | db.SQLFragment | db.ParentColumn>;\n /**\n * **subjectPhotos.photoId**\n * - `int4` in database\n * - `NOT NULL`, no default\n */\n photoId?: number | db.Parameter | db.SQLFragment | db.ParentColumn | db.SQLFragment | db.SQLFragment | db.ParentColumn>;\n }\n export interface Insertable {\n /**\n * **subjectPhotos.subjectId**\n * - `int4` in database\n * - `NOT NULL`, no default\n */\n subjectId: number | db.Parameter | db.SQLFragment;\n /**\n * **subjectPhotos.photoId**\n * - `int4` in database\n * - `NOT NULL`, no default\n */\n photoId: number | db.Parameter | db.SQLFragment;\n }\n export interface Updatable {\n /**\n * **subjectPhotos.subjectId**\n * - `int4` in database\n * - `NOT NULL`, no default\n */\n subjectId?: number | db.Parameter | db.SQLFragment | db.SQLFragment | db.SQLFragment>;\n /**\n * **subjectPhotos.photoId**\n * - `int4` in database\n * - `NOT NULL`, no default\n */\n photoId?: number | db.Parameter | db.SQLFragment | db.SQLFragment | db.SQLFragment>;\n }\n export type UniqueIndex = 'userphotosunique';\n export type Column = keyof Selectable;\n export type OnlyCols = Pick;\n export type SQLExpression = Table | db.ColumnNames | db.ColumnValues | Whereable | Column | db.ParentColumn | db.GenericSQLExpression;\n export type SQL = SQLExpression | SQLExpression[];\n }\n\n /**\n * **subjects**\n * - Table in database\n */\n export namespace subjects {\n export type Table = 'subjects';\n export interface Selectable {\n /**\n * **subjects.subjectId**\n * - `int4` in database\n * - `NOT NULL`, identity column\n */\n subjectId: number;\n /**\n * **subjects.name**\n * - `text` in database\n * - `NOT NULL`, no default\n */\n name: string;\n }\n export interface JSONSelectable {\n /**\n * **subjects.subjectId**\n * - `int4` in database\n * - `NOT NULL`, identity column\n */\n subjectId: number;\n /**\n * **subjects.name**\n * - `text` in database\n * - `NOT NULL`, no default\n */\n name: string;\n }\n export interface Whereable {\n /**\n * **subjects.subjectId**\n * - `int4` in database\n * - `NOT NULL`, identity column\n */\n subjectId?: number | db.Parameter | db.SQLFragment | db.ParentColumn | db.SQLFragment | db.SQLFragment | db.ParentColumn>;\n /**\n * **subjects.name**\n * - `text` in database\n * - `NOT NULL`, no default\n */\n name?: string | db.Parameter | db.SQLFragment | db.ParentColumn | db.SQLFragment | db.SQLFragment | db.ParentColumn>;\n }\n export interface Insertable {\n /**\n * **subjects.subjectId**\n * - `int4` in database\n * - `NOT NULL`, identity column\n */\n subjectId?: number | db.Parameter | db.DefaultType | db.SQLFragment;\n /**\n * **subjects.name**\n * - `text` in database\n * - `NOT NULL`, no default\n */\n name: string | db.Parameter | db.SQLFragment;\n }\n export interface Updatable {\n /**\n * **subjects.subjectId**\n * - `int4` in database\n * - `NOT NULL`, identity column\n */\n subjectId?: number | db.Parameter | db.DefaultType | db.SQLFragment | db.SQLFragment | db.DefaultType | db.SQLFragment>;\n /**\n * **subjects.name**\n * - `text` in database\n * - `NOT NULL`, no default\n */\n name?: string | db.Parameter | db.SQLFragment | db.SQLFragment | db.SQLFragment>;\n }\n export type UniqueIndex = 'subjects_pkey';\n export type Column = keyof Selectable;\n export type OnlyCols = Pick;\n export type SQLExpression = Table | db.ColumnNames | db.ColumnValues | Whereable | Column | db.ParentColumn | db.GenericSQLExpression;\n export type SQL = SQLExpression | SQLExpression[];\n }\n\n /**\n * **tags**\n * - Table in database\n */\n export namespace tags {\n export type Table = 'tags';\n export interface Selectable {\n /**\n * **tags.tag**\n * - `text` in database\n * - `NOT NULL`, no default\n */\n tag: string;\n /**\n * **tags.bookId**\n * - `int4` in database\n * - `NOT NULL`, no default\n */\n bookId: number;\n }\n export interface JSONSelectable {\n /**\n * **tags.tag**\n * - `text` in database\n * - `NOT NULL`, no default\n */\n tag: string;\n /**\n * **tags.bookId**\n * - `int4` in database\n * - `NOT NULL`, no default\n */\n bookId: number;\n }\n export interface Whereable {\n /**\n * **tags.tag**\n * - `text` in database\n * - `NOT NULL`, no default\n */\n tag?: string | db.Parameter | db.SQLFragment | db.ParentColumn | db.SQLFragment | db.SQLFragment | db.ParentColumn>;\n /**\n * **tags.bookId**\n * - `int4` in database\n * - `NOT NULL`, no default\n */\n bookId?: number | db.Parameter | db.SQLFragment | db.ParentColumn | db.SQLFragment | db.SQLFragment | db.ParentColumn>;\n }\n export interface Insertable {\n /**\n * **tags.tag**\n * - `text` in database\n * - `NOT NULL`, no default\n */\n tag: string | db.Parameter | db.SQLFragment;\n /**\n * **tags.bookId**\n * - `int4` in database\n * - `NOT NULL`, no default\n */\n bookId: number | db.Parameter | db.SQLFragment;\n }\n export interface Updatable {\n /**\n * **tags.tag**\n * - `text` in database\n * - `NOT NULL`, no default\n */\n tag?: string | db.Parameter | db.SQLFragment | db.SQLFragment | db.SQLFragment>;\n /**\n * **tags.bookId**\n * - `int4` in database\n * - `NOT NULL`, no default\n */\n bookId?: number | db.Parameter | db.SQLFragment | db.SQLFragment | db.SQLFragment>;\n }\n export type UniqueIndex = 'tagsUniqueIdx';\n export type Column = keyof Selectable;\n export type OnlyCols = Pick;\n export type SQLExpression = Table | db.ColumnNames | db.ColumnValues | Whereable | Column | db.ParentColumn | db.GenericSQLExpression;\n export type SQL = SQLExpression | SQLExpression[];\n }\n\n /**\n * **usedVoucherCodes**\n * - Table in database\n */\n export namespace usedVoucherCodes {\n export type Table = 'usedVoucherCodes';\n export interface Selectable {\n /**\n * **usedVoucherCodes.code**\n * - `text` in database\n * - `NOT NULL`, no default\n */\n code: string;\n /**\n * **usedVoucherCodes.redeemedAt**\n * - `timestamptz` in database\n * - `NOT NULL`, default: `now()`\n */\n redeemedAt: Date;\n }\n export interface JSONSelectable {\n /**\n * **usedVoucherCodes.code**\n * - `text` in database\n * - `NOT NULL`, no default\n */\n code: string;\n /**\n * **usedVoucherCodes.redeemedAt**\n * - `timestamptz` in database\n * - `NOT NULL`, default: `now()`\n */\n redeemedAt: db.TimestampTzString;\n }\n export interface Whereable {\n /**\n * **usedVoucherCodes.code**\n * - `text` in database\n * - `NOT NULL`, no default\n */\n code?: string | db.Parameter | db.SQLFragment | db.ParentColumn | db.SQLFragment | db.SQLFragment | db.ParentColumn>;\n /**\n * **usedVoucherCodes.redeemedAt**\n * - `timestamptz` in database\n * - `NOT NULL`, default: `now()`\n */\n redeemedAt?: (db.TimestampTzString | Date) | db.Parameter<(db.TimestampTzString | Date)> | db.SQLFragment | db.ParentColumn | db.SQLFragment | db.SQLFragment | db.ParentColumn>;\n }\n export interface Insertable {\n /**\n * **usedVoucherCodes.code**\n * - `text` in database\n * - `NOT NULL`, no default\n */\n code: string | db.Parameter | db.SQLFragment;\n /**\n * **usedVoucherCodes.redeemedAt**\n * - `timestamptz` in database\n * - `NOT NULL`, default: `now()`\n */\n redeemedAt?: (db.TimestampTzString | Date) | db.Parameter<(db.TimestampTzString | Date)> | db.DefaultType | db.SQLFragment;\n }\n export interface Updatable {\n /**\n * **usedVoucherCodes.code**\n * - `text` in database\n * - `NOT NULL`, no default\n */\n code?: string | db.Parameter | db.SQLFragment | db.SQLFragment | db.SQLFragment>;\n /**\n * **usedVoucherCodes.redeemedAt**\n * - `timestamptz` in database\n * - `NOT NULL`, default: `now()`\n */\n redeemedAt?: (db.TimestampTzString | Date) | db.Parameter<(db.TimestampTzString | Date)> | db.DefaultType | db.SQLFragment | db.SQLFragment | db.DefaultType | db.SQLFragment>;\n }\n export type UniqueIndex = 'usedVoucherCodes_pkey';\n export type Column = keyof Selectable;\n export type OnlyCols = Pick;\n export type SQLExpression = Table | db.ColumnNames | db.ColumnValues | Whereable | Column | db.ParentColumn | db.GenericSQLExpression;\n export type SQL = SQLExpression | SQLExpression[];\n }\n\n /**\n * **users**\n * - Table in database\n */\n export namespace users {\n export type Table = 'users';\n export interface Selectable {\n /**\n * **users.id**\n * - `int4` in database\n * - `NOT NULL`, identity column\n */\n id: number;\n /**\n * **users.ipOctet**\n * - `int4` in database\n * - `NOT NULL`, identity column\n */\n ipOctet: number;\n /**\n * **users.friendlyName**\n * - `text` in database\n * - Nullable, no default\n */\n friendlyName: string | null;\n }\n export interface JSONSelectable {\n /**\n * **users.id**\n * - `int4` in database\n * - `NOT NULL`, identity column\n */\n id: number;\n /**\n * **users.ipOctet**\n * - `int4` in database\n * - `NOT NULL`, identity column\n */\n ipOctet: number;\n /**\n * **users.friendlyName**\n * - `text` in database\n * - Nullable, no default\n */\n friendlyName: string | null;\n }\n export interface Whereable {\n /**\n * **users.id**\n * - `int4` in database\n * - `NOT NULL`, identity column\n */\n id?: number | db.Parameter | db.SQLFragment | db.ParentColumn | db.SQLFragment