fraiseql-core 2.15.0

Core execution engine for FraiseQL v2 - Compiled GraphQL over SQL
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
//! Shared test fixtures for executor tests.
//!
//! All items here are `pub` so they can be used by:
//! - `executor::tests` (via `use super::test_support::*`)
//! - `executor::runners::mutation::tests` (via `use crate::runtime::executor::test_support::*`)
//! - `executor::runners::query::tests` (via `use crate::runtime::executor::test_support::*`)

#![allow(clippy::unwrap_used)] // Reason: test support code, panics are acceptable

use std::collections::HashMap;

use async_trait::async_trait;
use indexmap::IndexMap;

use crate::{
    backend::{
        CursorValue, MutationRowGate, RelayPageResult, WriteRequest, Writer,
        traits::{DatabaseAdapter, RelayDatabaseAdapter},
        types::{DatabaseType, JsonbValue, PoolMetrics, sql_hints::OrderByClause},
        where_clause::WhereClause,
    },
    error::Result,
    schema::{AutoParams, CompiledSchema, CursorType, QueryDefinition},
};

/// Capturing mock that records the WHERE clause and limit/offset it receives.
/// Used to verify parameter threading from executor to adapter.
pub struct CapturingMockAdapter {
    pub mock_results:                    Vec<JsonbValue>,
    /// Rows the parameterized-aggregate path returns — the shape the federation
    /// `_entities` resolver reads. Empty by default, which is what every caller
    /// asserting only *whether* the resolver ran wants; set it with
    /// [`with_aggregate_rows`](Self::with_aggregate_rows) to assert on the values
    /// that come back (field masking, projection).
    pub mock_aggregate_rows:             Vec<std::collections::HashMap<String, serde_json::Value>>,
    pub captured_where:                  std::sync::Mutex<Option<WhereClause>>,
    pub captured_limit:                  std::sync::Mutex<Option<u32>>,
    pub captured_offset:                 std::sync::Mutex<Option<u32>>,
    /// The ORDER BY the last read resolved to.
    ///
    /// `execute_with_projection` used to drop its `order_by` on the floor and
    /// call `execute_where_query` with `None`, so the mock could not have
    /// witnessed an ordering even if something had recorded it — a test
    /// asserting on the sort would have been green against an engine that
    /// emitted none (#1284).
    pub captured_order_by:               std::sync::Mutex<Option<Vec<OrderByClause>>>,
    pub captured_aggregate_sql:          std::sync::Mutex<Option<String>>,
    pub captured_aggregate_params:       std::sync::Mutex<Option<Vec<serde_json::Value>>>,
    pub captured_aggregate_session_vars: std::sync::Mutex<Option<Vec<(String, String)>>>,
    /// Rows the row-shaped read returns (#1351).
    pub mock_row_results:                Vec<Vec<crate::backend::types::ColumnValue>>,
    /// What the last row-shaped read asked the adapter for.
    pub captured_row_read:               std::sync::Mutex<Option<CapturedRowRead>>,
    /// The composed read (`?select=` embedding) handed to the adapter, answered with
    /// `mock_results` — which a composed-read test therefore fills with composed rows.
    pub captured_composed:               std::sync::Mutex<Option<crate::backend::ComposedLevel>>,
    /// What `supports_composed_reads` answers; `true` unless built
    /// [`without_composed_reads`](Self::without_composed_reads).
    pub composes_reads:                  bool,
}

/// The arguments a row-shaped read reached the adapter with (#1351).
///
/// Records the **lowered** call — the `Option<&str>` pair the column-shaped
/// adapter methods take — because that is where a gate that did not run becomes
/// visible: an uncapped limit, an absent RLS predicate, or a column the caller
/// may not read are all arguments, not return values.
#[derive(Debug, Clone)]
pub struct CapturedRowRead {
    pub view:         String,
    /// Column names, in the order the read projected them.
    pub columns:      Vec<String>,
    pub where_sql:    Option<String>,
    pub order_by:     Option<String>,
    pub limit:        Option<u32>,
    pub offset:       Option<u32>,
    pub session_vars: Vec<(String, String)>,
}

impl CapturingMockAdapter {
    pub fn new(mock_results: Vec<JsonbValue>) -> Self {
        Self {
            mock_results,
            mock_aggregate_rows: Vec::new(),
            captured_where: std::sync::Mutex::new(None),
            captured_limit: std::sync::Mutex::new(None),
            captured_offset: std::sync::Mutex::new(None),
            captured_order_by: std::sync::Mutex::new(None),
            captured_aggregate_sql: std::sync::Mutex::new(None),
            captured_aggregate_params: std::sync::Mutex::new(None),
            captured_aggregate_session_vars: std::sync::Mutex::new(None),
            mock_row_results: Vec::new(),
            captured_row_read: std::sync::Mutex::new(None),
            captured_composed: std::sync::Mutex::new(None),
            composes_reads: true,
        }
    }

    /// The same double, claiming no composed-read capability — an adapter like the wire
    /// backend, which serves plain reads and cannot compose.
    #[must_use]
    pub fn without_composed_reads(mut self) -> Self {
        self.composes_reads = false;
        self
    }

    /// Rows for the parameterized-aggregate path (the federation `_entities` read).
    ///
    /// Each row is a flat column→value map, exactly what
    /// `DatabaseEntityResolver::project_results` matches against a representation's
    /// key fields.
    ///
    /// Its only caller is the `entities_authz` test module, which is
    /// `#[cfg(feature = "federation")]` — so in a build without that feature the method
    /// genuinely has no caller and `-D dead-code` is right to say so. Allowed there and
    /// **only** there, rather than with a blanket `#[allow(dead_code)]`, so the lint still
    /// fires if the federation-enabled caller ever disappears.
    #[cfg_attr(not(feature = "federation"), allow(dead_code))]
    #[must_use]
    pub fn with_aggregate_rows(
        mut self,
        rows: Vec<std::collections::HashMap<String, serde_json::Value>>,
    ) -> Self {
        self.mock_aggregate_rows = rows;
        self
    }

    pub fn captured_where(&self) -> Option<WhereClause> {
        self.captured_where.lock().unwrap().clone()
    }

    pub fn captured_limit(&self) -> Option<u32> {
        *self.captured_limit.lock().unwrap()
    }

    pub fn captured_offset(&self) -> Option<u32> {
        *self.captured_offset.lock().unwrap()
    }

    pub fn captured_order_by(&self) -> Option<Vec<OrderByClause>> {
        self.captured_order_by.lock().unwrap().clone()
    }

    pub fn captured_aggregate_sql(&self) -> Option<String> {
        self.captured_aggregate_sql.lock().unwrap().clone()
    }

    #[allow(dead_code)] // Reason: available for future aggregate RLS param verification tests
    pub fn captured_aggregate_params(&self) -> Option<Vec<serde_json::Value>> {
        self.captured_aggregate_params.lock().unwrap().clone()
    }

    /// The session variables the last `_with_session` aggregate call received.
    /// `None` means the non-session `execute_parameterized_aggregate` was called
    /// (no session variables reached the connection) — the #610 partial-period gap.
    pub fn captured_aggregate_session_vars(&self) -> Option<Vec<(String, String)>> {
        self.captured_aggregate_session_vars.lock().unwrap().clone()
    }

    /// Rows for the row-shaped read (#1351).
    #[must_use]
    pub fn with_row_results(mut self, rows: Vec<Vec<crate::backend::types::ColumnValue>>) -> Self {
        self.mock_row_results = rows;
        self
    }

    /// What the last row-shaped read asked for, or `None` if none reached the
    /// adapter — which is the assertion a gate that refuses before dispatch needs.
    pub fn captured_row_read(&self) -> Option<CapturedRowRead> {
        self.captured_row_read.lock().unwrap().clone()
    }

    pub fn captured_composed(&self) -> Option<crate::backend::ComposedLevel> {
        self.captured_composed.lock().unwrap().clone()
    }
}

// Reason: DatabaseAdapter is defined with #[async_trait]; all implementations must match
// async_trait: dyn-dispatch required; remove when RTN + Send is stable (RFC 3425)
#[async_trait]
impl DatabaseAdapter for CapturingMockAdapter {
    async fn execute_with_projection(
        &self,
        view: &str,
        _projection: Option<&crate::schema::SqlProjectionHint>,
        where_clause: Option<&WhereClause>,
        limit: Option<u32>,
        offset: Option<u32>,
        order_by: Option<&[OrderByClause]>,
    ) -> Result<Vec<JsonbValue>> {
        self.execute_where_query(view, where_clause, limit, offset, order_by).await
    }

    async fn execute_where_query(
        &self,
        _view: &str,
        where_clause: Option<&WhereClause>,
        limit: Option<u32>,
        offset: Option<u32>,
        order_by: Option<&[OrderByClause]>,
    ) -> Result<Vec<JsonbValue>> {
        *self.captured_where.lock().unwrap() = where_clause.cloned();
        *self.captured_limit.lock().unwrap() = limit;
        *self.captured_offset.lock().unwrap() = offset;
        *self.captured_order_by.lock().unwrap() = order_by.map(<[OrderByClause]>::to_vec);
        Ok(self.mock_results.clone())
    }

    fn supports_composed_reads(&self) -> bool {
        self.composes_reads
    }

    async fn execute_composed_with_session(
        &self,
        read: &crate::backend::ComposedLevel,
        _session_vars: &[(&str, &str)],
        _routing: crate::backend::types::ReadRouting,
    ) -> Result<std::sync::Arc<Vec<JsonbValue>>> {
        *self.captured_composed.lock().unwrap() = Some(read.clone());
        Ok(std::sync::Arc::new(self.mock_results.clone()))
    }

    async fn health_check(&self) -> Result<()> {
        Ok(())
    }

    fn database_type(&self) -> DatabaseType {
        DatabaseType::PostgreSQL
    }

    fn pool_metrics(&self) -> PoolMetrics {
        PoolMetrics {
            total_connections:  1,
            active_connections: 0,
            idle_connections:   1,
            waiting_requests:   0,
        }
    }

    async fn execute_raw_query(
        &self,
        _sql: &str,
    ) -> Result<Vec<std::collections::HashMap<String, serde_json::Value>>> {
        Ok(vec![])
    }

    /// Records the row-shaped read (#1351).
    ///
    /// Both arms are recorded, and the session variables distinguish them: an
    /// engine that called the session-free method would be witnessed here with an
    /// empty `session_vars`, so a test asserting the variables travelled fails
    /// rather than passing against a read that silently dropped them.
    async fn execute_row_query(
        &self,
        view_name: &str,
        columns: &[crate::backend::types::ColumnSpec],
        where_sql: Option<&str>,
        order_by: Option<&str>,
        limit: Option<u32>,
        offset: Option<u32>,
    ) -> Result<Vec<Vec<crate::backend::types::ColumnValue>>> {
        *self.captured_row_read.lock().unwrap() = Some(CapturedRowRead {
            view: view_name.to_string(),
            columns: columns.iter().map(|c| c.name.clone()).collect(),
            where_sql: where_sql.map(str::to_string),
            order_by: order_by.map(str::to_string),
            limit,
            offset,
            session_vars: Vec::new(),
        });
        Ok(self.mock_row_results.clone())
    }

    async fn execute_row_query_with_session(
        &self,
        view_name: &str,
        columns: &[crate::backend::types::ColumnSpec],
        where_sql: Option<&str>,
        order_by: Option<&str>,
        limit: Option<u32>,
        offset: Option<u32>,
        session_vars: &[(&str, &str)],
    ) -> Result<Vec<Vec<crate::backend::types::ColumnValue>>> {
        *self.captured_row_read.lock().unwrap() = Some(CapturedRowRead {
            view: view_name.to_string(),
            columns: columns.iter().map(|c| c.name.clone()).collect(),
            where_sql: where_sql.map(str::to_string),
            order_by: order_by.map(str::to_string),
            limit,
            offset,
            session_vars: session_vars
                .iter()
                .map(|(k, v)| ((*k).to_string(), (*v).to_string()))
                .collect(),
        });
        Ok(self.mock_row_results.clone())
    }

    async fn execute_parameterized_aggregate(
        &self,
        sql: &str,
        params: &[serde_json::Value],
    ) -> Result<Vec<std::collections::HashMap<String, serde_json::Value>>> {
        *self.captured_aggregate_sql.lock().unwrap() = Some(sql.to_string());
        *self.captured_aggregate_params.lock().unwrap() = Some(params.to_vec());
        Ok(self.mock_aggregate_rows.clone())
    }

    async fn execute_parameterized_aggregate_with_session(
        &self,
        sql: &str,
        params: &[serde_json::Value],
        session_vars: &[(&str, &str)],
        _routing: crate::backend::types::ReadRouting,
    ) -> Result<Vec<std::collections::HashMap<String, serde_json::Value>>> {
        *self.captured_aggregate_session_vars.lock().unwrap() =
            Some(session_vars.iter().map(|(k, v)| ((*k).to_string(), (*v).to_string())).collect());
        // Delegate so SQL/params capture stays identical to the non-session path.
        self.execute_parameterized_aggregate(sql, params).await
    }
}

// Writes answer no rows; they are put to the gate, as the PostgreSQL adapter puts the
// function's rows to it before its transaction ends.
// async_trait: dyn-dispatch required; remove when RTN + Send is stable (RFC 3425)
#[async_trait]
impl Writer for CapturingMockAdapter {
    async fn execute_write(
        &self,
        _request: &WriteRequest<'_>,
        gate: MutationRowGate<'_>,
    ) -> Result<Vec<std::collections::HashMap<String, serde_json::Value>>> {
        let rows = Vec::new();
        gate(&rows)?;
        Ok(rows)
    }
}

/// Mock database adapter for testing.
///
/// Supports both uniform mode (same results for every view) and per-view mode
/// (`with_view()` builder) so tests can verify correct query routing.
pub struct MockAdapter {
    /// Default results returned for any view that has no specific override.
    pub mock_results:     Vec<JsonbValue>,
    /// Per-view result overrides. When present, `execute_where_query` returns
    /// these instead of `mock_results`, enabling routing-correctness tests.
    pub view_responses:   std::collections::HashMap<String, Vec<JsonbValue>>,
    /// Every statement that reached `execute_raw_query`, in order.
    ///
    /// Recorded so a test asserting that something was *refused* can witness that
    /// nothing ran, rather than inferring it from the returned error — an error and
    /// an executed statement are not mutually exclusive.
    pub captured_raw_sql: std::sync::Mutex<Vec<String>>,
}

impl MockAdapter {
    /// Uniform mode: all views return the same results.
    pub fn new(mock_results: Vec<JsonbValue>) -> Self {
        Self {
            mock_results,
            view_responses: std::collections::HashMap::new(),
            captured_raw_sql: std::sync::Mutex::new(Vec::new()),
        }
    }

    /// The statements `execute_raw_query` saw, in order.
    pub fn raw_sql(&self) -> Vec<String> {
        self.captured_raw_sql.lock().unwrap().clone()
    }

    /// Per-view mode builder: register a specific result set for a named view.
    pub fn with_view(mut self, view: &str, results: Vec<JsonbValue>) -> Self {
        self.view_responses.insert(view.to_string(), results);
        self
    }
}

// Reason: DatabaseAdapter is defined with #[async_trait]; all implementations must match
// its transformed method signatures to satisfy the trait contract
// async_trait: dyn-dispatch required; remove when RTN + Send is stable (RFC 3425)
#[async_trait]
impl DatabaseAdapter for MockAdapter {
    async fn execute_with_projection(
        &self,
        view: &str,
        _projection: Option<&crate::schema::SqlProjectionHint>,
        where_clause: Option<&WhereClause>,
        limit: Option<u32>,
        _offset: Option<u32>,
        _order_by: Option<&[OrderByClause]>,
    ) -> Result<Vec<JsonbValue>> {
        // Fall back to standard query for tests
        self.execute_where_query(view, where_clause, limit, None, None).await
    }

    async fn execute_where_query(
        &self,
        view: &str,
        _where_clause: Option<&WhereClause>,
        _limit: Option<u32>,
        _offset: Option<u32>,
        _order_by: Option<&[OrderByClause]>,
    ) -> Result<Vec<JsonbValue>> {
        // Return per-view override if registered, otherwise fall back to uniform results.
        if let Some(results) = self.view_responses.get(view) {
            return Ok(results.clone());
        }
        Ok(self.mock_results.clone())
    }

    async fn health_check(&self) -> Result<()> {
        Ok(())
    }

    fn database_type(&self) -> DatabaseType {
        DatabaseType::PostgreSQL
    }

    fn pool_metrics(&self) -> PoolMetrics {
        PoolMetrics {
            total_connections:  1,
            active_connections: 0,
            idle_connections:   1,
            waiting_requests:   0,
        }
    }

    async fn execute_raw_query(
        &self,
        sql: &str,
    ) -> Result<Vec<std::collections::HashMap<String, serde_json::Value>>> {
        self.captured_raw_sql.lock().unwrap().push(sql.to_string());
        Ok(vec![])
    }

    async fn execute_parameterized_aggregate(
        &self,
        _sql: &str,
        _params: &[serde_json::Value],
    ) -> Result<Vec<std::collections::HashMap<String, serde_json::Value>>> {
        Ok(vec![])
    }
}

// Writes answer no rows; they are put to the gate, as the PostgreSQL adapter puts the
// function's rows to it before its transaction ends.
// async_trait: dyn-dispatch required; remove when RTN + Send is stable (RFC 3425)
#[async_trait]
impl Writer for MockAdapter {
    async fn execute_write(
        &self,
        _request: &WriteRequest<'_>,
        gate: MutationRowGate<'_>,
    ) -> Result<Vec<std::collections::HashMap<String, serde_json::Value>>> {
        let rows = Vec::new();
        gate(&rows)?;
        Ok(rows)
    }
}

/// Relay dispatch over the mock, so a test can build a relay-capable executor.
///
/// Returns an empty page: the tests that need this are about whether relay dispatch
/// is *present*, not about what it pages over.
impl RelayDatabaseAdapter for MockAdapter {
    async fn execute_relay_page<'a>(
        &'a self,
        _view: &'a str,
        _cursor_column: &'a str,
        _after: Option<CursorValue>,
        _before: Option<CursorValue>,
        _limit: u32,
        _forward: bool,
        _where_clause: Option<&'a WhereClause>,
        _order_by: Option<&'a [OrderByClause]>,
        _include_total_count: bool,
    ) -> Result<RelayPageResult> {
        Ok(RelayPageResult::new(Vec::new(), None))
    }
}

/// Read-only adapter: not a `Writer`, so an executor over it is built read-only and refuses
/// every mutation.
pub struct ReadOnlyMockAdapter;

// Reason: DatabaseAdapter is defined with #[async_trait]; all implementations must match
// its transformed method signatures to satisfy the trait contract
// async_trait: dyn-dispatch required; remove when RTN + Send is stable (RFC 3425)
#[async_trait]
impl DatabaseAdapter for ReadOnlyMockAdapter {
    async fn execute_with_projection(
        &self,
        view: &str,
        _projection: Option<&crate::schema::SqlProjectionHint>,
        where_clause: Option<&WhereClause>,
        limit: Option<u32>,
        _offset: Option<u32>,
        _order_by: Option<&[OrderByClause]>,
    ) -> Result<Vec<JsonbValue>> {
        self.execute_where_query(view, where_clause, limit, None, None).await
    }

    async fn execute_where_query(
        &self,
        _view: &str,
        _where_clause: Option<&WhereClause>,
        _limit: Option<u32>,
        _offset: Option<u32>,
        _order_by: Option<&[OrderByClause]>,
    ) -> Result<Vec<JsonbValue>> {
        Ok(vec![])
    }

    async fn health_check(&self) -> Result<()> {
        Ok(())
    }

    fn database_type(&self) -> DatabaseType {
        DatabaseType::PostgreSQL
    }

    fn pool_metrics(&self) -> PoolMetrics {
        PoolMetrics {
            total_connections:  1,
            active_connections: 0,
            idle_connections:   1,
            waiting_requests:   0,
        }
    }

    async fn execute_raw_query(
        &self,
        _sql: &str,
    ) -> Result<Vec<std::collections::HashMap<String, serde_json::Value>>> {
        Ok(vec![])
    }

    async fn execute_parameterized_aggregate(
        &self,
        _sql: &str,
        _params: &[serde_json::Value],
    ) -> Result<Vec<std::collections::HashMap<String, serde_json::Value>>> {
        Ok(vec![])
    }
}

pub fn test_schema() -> CompiledSchema {
    let mut schema = CompiledSchema::new();
    schema.queries.push(QueryDefinition {
        function: None,

        requires_actor:      Vec::new(),
        returns_count:       false,
        name:                "users".to_string(),
        return_type:         "User".to_string(),
        returns_list:        true,
        nullable:            false,
        arguments:           Vec::new(),
        sql_source:          Some("v_user".to_string()),
        description:         None,
        // The fixtures built on this schema paginate and filter (`users(limit: 100)`),
        // and since #1154 an argument the query does not accept is a validation error
        // rather than a silently dropped one — so the fixture has to declare the
        // auto-wired surface it is exercised through.
        auto_params:         AutoParams::all(),
        deprecation:         None,
        jsonb_column:        "data".to_string(),
        relay:               false,
        relay_cursor_column: None,
        relay_cursor_type:   CursorType::default(),
        inject_params:       IndexMap::default(),
        read_routing:        crate::backend::types::ReadRouting::default(),
        cache_ttl_seconds:   None,
        additional_views:    vec![],
        requires_role:       None,
        rest_path:           None,
        rest_method:         None,
        rest_stream:         false,
        native_columns:      HashMap::new(),
        // #1303: what `SchemaConverter::resolve_pagination_order` gives this exact
        // shape — a paginating list query with no authored override — from a compile
        // with no `--database`. Left at `None` this fixture would describe a route
        // the compiler cannot emit, and, worse, the *pre-fix* route: every test built
        // on it would go on asserting the unordered behaviour after the defect was
        // fixed, and the suite would not move when the bug did.
        pagination_order:    Some(crate::schema::PaginationOrder::JsonIdentity),
    });
    schema
}

pub fn mock_user_results() -> Vec<JsonbValue> {
    vec![
        JsonbValue::new(serde_json::json!({"id": "1", "name": "Alice"})),
        JsonbValue::new(serde_json::json!({"id": "2", "name": "Bob"})),
    ]
}