|
1 | 1 | (ns lrsql.postgres.record |
2 | 2 | (:require [com.stuartsierra.component :as cmp] |
3 | 3 | [hugsql.core :as hug] |
| 4 | + [next.jdbc :as jdbc] |
4 | 5 | [lrsql.backend.data :as bd] |
5 | 6 | [lrsql.backend.protocol :as bp] |
6 | 7 | [lrsql.init :refer [init-hugsql-adapter!]] |
|
18 | 19 | (hug/def-db-fns "lrsql/postgres/sql/update.sql") |
19 | 20 | (hug/def-db-fns "lrsql/postgres/sql/delete.sql") |
20 | 21 |
|
| 22 | +(hug/def-sqlvec-fns "lrsql/postgres/sql/query.sql") |
| 23 | + |
21 | 24 | ;; Define record |
22 | 25 | #_{:clj-kondo/ignore [:unresolved-symbol]} ; Shut up VSCode warnings |
23 | 26 | (defrecord PostgresBackend [tuning] |
|
77 | 80 | (add-statement-to-actor-cascading-delete! tx)) |
78 | 81 | (when (some? (query-varchar-exists tx)) |
79 | 82 | (convert-varchars-to-text! tx)) |
80 | | - (create-blocked-jwt-table! tx)) |
| 83 | + (create-blocked-jwt-table! tx) |
| 84 | + (alter-blocked-jwt-add-one-time-id! tx)) |
81 | 85 |
|
82 | 86 | bp/BackendUtil |
83 | 87 | (-txn-retry? [_ ex] |
|
103 | 107 | (query-statement-exists tx input)) |
104 | 108 | (-query-statement-descendants [_ tx input] |
105 | 109 | (query-statement-descendants tx input)) |
| 110 | + (-query-statements-lazy [_ tx input] |
| 111 | + (let [sqlvec (query-statements-sqlvec input)] |
| 112 | + (jdbc/plan tx sqlvec {:fetch-size 4000 |
| 113 | + :concurrency :read-only |
| 114 | + :cursors :close |
| 115 | + :result-type :forward-only}))) |
106 | 116 |
|
107 | 117 | bp/ActorBackend |
108 | 118 | (-insert-actor! [_ tx input] |
|
201 | 211 | bp/JWTBlocklistBackend |
202 | 212 | (-insert-blocked-jwt! [_ tx input] |
203 | 213 | (insert-blocked-jwt! tx input)) |
| 214 | + (-insert-one-time-jwt! [_ tx input] |
| 215 | + (insert-one-time-jwt! tx input)) |
| 216 | + (-update-one-time-jwt! [_ tx input] |
| 217 | + (update-one-time-jwt! tx input)) |
204 | 218 | (-delete-blocked-jwt-by-time! [_ tx input] |
205 | 219 | (delete-blocked-jwt-by-time! tx input)) |
206 | 220 | (-query-blocked-jwt [_ tx input] |
207 | 221 | (query-blocked-jwt-exists tx input)) |
| 222 | + (-query-one-time-jwt [_ tx input] |
| 223 | + (query-one-time-jwt-exists tx input)) |
208 | 224 |
|
209 | 225 | bp/CredentialBackend |
210 | 226 | (-insert-credential! [_ tx input] |
|
0 commit comments