turso_sdk_kit 0.7.2

Low-level C ABI for building Turso language bindings. For Rust applications, use the `turso` crate instead.
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
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
/* automatically generated by rust-bindgen 0.71.1 */

#[doc = " SAFETY: slice with non-null ptr must points to the valid memory range [ptr..ptr + len)\n ownership of the slice is not transferred - so its either caller owns the data or turso\n as the owner doesn't change - there is no method to free the slice reference - because:\n 1. if tursodb owns it - it will clean it in appropriate time\n 2. if caller owns it - it must clean it in appropriate time with appropriate method and tursodb doesn't know how to properly free the data"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct turso_slice_ref_t {
    pub ptr: *const ::std::os::raw::c_void,
    pub len: usize,
}
impl Default for turso_slice_ref_t {
    fn default() -> Self {
        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
        unsafe {
            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
            s.assume_init()
        }
    }
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum turso_status_code_t {
    TURSO_OK = 0,
    TURSO_DONE = 1,
    TURSO_ROW = 2,
    TURSO_IO = 3,
    TURSO_BUSY = 4,
    TURSO_INTERRUPT = 5,
    TURSO_BUSY_SNAPSHOT = 6,
    TURSO_ERROR = 127,
    TURSO_MISUSE = 128,
    TURSO_CONSTRAINT = 129,
    TURSO_READONLY = 130,
    TURSO_DATABASE_FULL = 131,
    TURSO_NOTADB = 132,
    TURSO_CORRUPT = 133,
    TURSO_IOERR = 134,
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum turso_type_t {
    TURSO_TYPE_UNKNOWN = 0,
    TURSO_TYPE_INTEGER = 1,
    TURSO_TYPE_REAL = 2,
    TURSO_TYPE_TEXT = 3,
    TURSO_TYPE_BLOB = 4,
    TURSO_TYPE_NULL = 5,
}
pub const turso_extension_value_type_t_TURSO_EXTENSION_VALUE_NULL: turso_extension_value_type_t = 0;
pub const turso_extension_value_type_t_TURSO_EXTENSION_VALUE_INTEGER: turso_extension_value_type_t =
    1;
pub const turso_extension_value_type_t_TURSO_EXTENSION_VALUE_FLOAT: turso_extension_value_type_t =
    2;
pub const turso_extension_value_type_t_TURSO_EXTENSION_VALUE_TEXT: turso_extension_value_type_t = 3;
pub const turso_extension_value_type_t_TURSO_EXTENSION_VALUE_BLOB: turso_extension_value_type_t = 4;
pub const turso_extension_value_type_t_TURSO_EXTENSION_VALUE_ERROR: turso_extension_value_type_t =
    5;
pub type turso_extension_value_type_t = ::std::os::raw::c_uint;
pub const turso_extension_result_code_t_TURSO_EXTENSION_RESULT_OK: turso_extension_result_code_t =
    0;
pub const turso_extension_result_code_t_TURSO_EXTENSION_RESULT_ERROR:
    turso_extension_result_code_t = 1;
pub const turso_extension_result_code_t_TURSO_EXTENSION_RESULT_INVALID_ARGS:
    turso_extension_result_code_t = 2;
pub const turso_extension_result_code_t_TURSO_EXTENSION_RESULT_UNKNOWN:
    turso_extension_result_code_t = 3;
pub const turso_extension_result_code_t_TURSO_EXTENSION_RESULT_OOM: turso_extension_result_code_t =
    4;
pub const turso_extension_result_code_t_TURSO_EXTENSION_RESULT_CORRUPT:
    turso_extension_result_code_t = 5;
pub const turso_extension_result_code_t_TURSO_EXTENSION_RESULT_NOT_FOUND:
    turso_extension_result_code_t = 6;
pub const turso_extension_result_code_t_TURSO_EXTENSION_RESULT_ALREADY_EXISTS:
    turso_extension_result_code_t = 7;
pub const turso_extension_result_code_t_TURSO_EXTENSION_RESULT_PERMISSION_DENIED:
    turso_extension_result_code_t = 8;
pub const turso_extension_result_code_t_TURSO_EXTENSION_RESULT_ABORTED:
    turso_extension_result_code_t = 9;
pub const turso_extension_result_code_t_TURSO_EXTENSION_RESULT_OUT_OF_RANGE:
    turso_extension_result_code_t = 10;
pub const turso_extension_result_code_t_TURSO_EXTENSION_RESULT_UNIMPLEMENTED:
    turso_extension_result_code_t = 11;
pub const turso_extension_result_code_t_TURSO_EXTENSION_RESULT_INTERNAL:
    turso_extension_result_code_t = 12;
pub const turso_extension_result_code_t_TURSO_EXTENSION_RESULT_UNAVAILABLE:
    turso_extension_result_code_t = 13;
pub const turso_extension_result_code_t_TURSO_EXTENSION_RESULT_CUSTOM_ERROR:
    turso_extension_result_code_t = 14;
pub const turso_extension_result_code_t_TURSO_EXTENSION_RESULT_EOF: turso_extension_result_code_t =
    15;
pub const turso_extension_result_code_t_TURSO_EXTENSION_RESULT_READ_ONLY:
    turso_extension_result_code_t = 16;
pub const turso_extension_result_code_t_TURSO_EXTENSION_RESULT_ROWID:
    turso_extension_result_code_t = 17;
pub const turso_extension_result_code_t_TURSO_EXTENSION_RESULT_ROW: turso_extension_result_code_t =
    18;
pub const turso_extension_result_code_t_TURSO_EXTENSION_RESULT_INTERRUPT:
    turso_extension_result_code_t = 19;
pub const turso_extension_result_code_t_TURSO_EXTENSION_RESULT_BUSY: turso_extension_result_code_t =
    20;
pub const turso_extension_result_code_t_TURSO_EXTENSION_RESULT_CONSTRAINT_VIOLATION:
    turso_extension_result_code_t = 21;
pub type turso_extension_result_code_t = ::std::os::raw::c_uint;
pub const turso_extension_text_subtype_t_TURSO_EXTENSION_TEXT_TEXT: turso_extension_text_subtype_t =
    0;
pub const turso_extension_text_subtype_t_TURSO_EXTENSION_TEXT_JSON: turso_extension_text_subtype_t =
    1;
pub type turso_extension_text_subtype_t = ::std::os::raw::c_uint;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct turso_extension_text_t {
    pub subtype: turso_extension_text_subtype_t,
    pub text: *const u8,
    pub len: u32,
}
impl Default for turso_extension_text_t {
    fn default() -> Self {
        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
        unsafe {
            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
            s.assume_init()
        }
    }
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct turso_extension_blob_t {
    pub data: *const u8,
    pub size: u64,
}
impl Default for turso_extension_blob_t {
    fn default() -> Self {
        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
        unsafe {
            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
            s.assume_init()
        }
    }
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct turso_extension_error_t {
    pub code: turso_extension_result_code_t,
    pub message: *mut turso_extension_text_t,
}
impl Default for turso_extension_error_t {
    fn default() -> Self {
        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
        unsafe {
            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
            s.assume_init()
        }
    }
}
#[repr(C)]
#[derive(Copy, Clone)]
pub union turso_extension_value_data_t {
    pub int_value: i64,
    pub float_value: f64,
    pub text: *const turso_extension_text_t,
    pub blob: *const turso_extension_blob_t,
    pub error: *const turso_extension_error_t,
}
impl Default for turso_extension_value_data_t {
    fn default() -> Self {
        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
        unsafe {
            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
            s.assume_init()
        }
    }
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct turso_value_t {
    pub value_type: turso_extension_value_type_t,
    pub value: turso_extension_value_data_t,
}
impl Default for turso_value_t {
    fn default() -> Self {
        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
        unsafe {
            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
            s.assume_init()
        }
    }
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct turso_agg_ctx_t {
    pub state: *mut ::std::os::raw::c_void,
}
impl Default for turso_agg_ctx_t {
    fn default() -> Self {
        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
        unsafe {
            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
            s.assume_init()
        }
    }
}
#[doc = " Frees per-registration state supplied to scalar, aggregate, or collation callbacks."]
pub type turso_context_destructor_t = ::std::option::Option<unsafe extern "C" fn(context: usize)>;
#[doc = " Frees a value returned by a managed scalar or aggregate callback after Turso copies it."]
pub type turso_value_destructor_t =
    ::std::option::Option<unsafe extern "C" fn(result: *mut turso_value_t)>;
#[doc = " Scalar callback. argv points to argc immutable turso_value_t entries valid only for the call."]
pub type turso_scalar_function_t = ::std::option::Option<
    unsafe extern "C" fn(
        context: usize,
        argc: i32,
        argv: *const turso_value_t,
        context_destructor: turso_context_destructor_t,
        value_destructor: turso_value_destructor_t,
    ) -> turso_value_t,
>;
#[doc = " Aggregate initializer. Return value is passed unchanged to step/final/destructor callbacks."]
pub type turso_aggregate_init_function_t =
    ::std::option::Option<unsafe extern "C" fn(context: usize) -> *mut turso_agg_ctx_t>;
#[doc = " Aggregate step callback. argv points to argc immutable turso_value_t entries valid only for the call."]
pub type turso_aggregate_step_function_t = ::std::option::Option<
    unsafe extern "C" fn(
        context: usize,
        aggregate_context: *mut turso_agg_ctx_t,
        argc: i32,
        argv: *const turso_value_t,
    ) -> turso_value_t,
>;
#[doc = " Aggregate final callback. The aggregate_context is the value returned by the initializer."]
pub type turso_aggregate_final_function_t = ::std::option::Option<
    unsafe extern "C" fn(context: usize, aggregate_context: *mut turso_agg_ctx_t) -> turso_value_t,
>;
#[doc = " Collation callback. Byte ranges are UTF-8 text valid only for the call. Return follows strcmp ordering."]
pub type turso_collation_function_t = ::std::option::Option<
    unsafe extern "C" fn(
        context: usize,
        left_ptr: *const u8,
        left_len: usize,
        right_ptr: *const u8,
        right_len: usize,
    ) -> i32,
>;
#[repr(u32)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum turso_tracing_level_t {
    TURSO_TRACING_LEVEL_ERROR = 1,
    TURSO_TRACING_LEVEL_WARN = 2,
    TURSO_TRACING_LEVEL_INFO = 3,
    TURSO_TRACING_LEVEL_DEBUG = 4,
    TURSO_TRACING_LEVEL_TRACE = 5,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct turso_database {
    _unused: [u8; 0],
}
#[doc = " opaque pointer to the TursoDatabase instance\n SAFETY: the database must be opened and closed only once but can be used concurrently"]
pub type turso_database_t = turso_database;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct turso_connection {
    _unused: [u8; 0],
}
#[doc = " opaque pointer to the TursoConnection instance\n SAFETY: the connection must be used exclusive and can't be accessed concurrently"]
pub type turso_connection_t = turso_connection;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct turso_statement {
    _unused: [u8; 0],
}
#[doc = " opaque pointer to the TursoStatement instance\n SAFETY: the statement must be used exclusive and can't be accessed concurrently"]
pub type turso_statement_t = turso_statement;
unsafe extern "C" {
    pub fn turso_version() -> *const ::std::os::raw::c_char;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct turso_log_t {
    pub message: *const ::std::os::raw::c_char,
    pub target: *const ::std::os::raw::c_char,
    pub file: *const ::std::os::raw::c_char,
    pub timestamp: u64,
    pub line: usize,
    pub level: turso_tracing_level_t,
}
impl Default for turso_log_t {
    fn default() -> Self {
        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
        unsafe {
            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
            s.assume_init()
        }
    }
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct turso_config_t {
    #[doc = " SAFETY: turso_log_t log argument fields have lifetime scoped to the logger invocation\n caller must ensure that data is properly copied if it wants it to have longer lifetime"]
    pub logger: ::std::option::Option<unsafe extern "C" fn(log: *const turso_log_t)>,
    pub log_level: *const ::std::os::raw::c_char,
}
impl Default for turso_config_t {
    fn default() -> Self {
        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
        unsafe {
            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
            s.assume_init()
        }
    }
}
#[doc = " Database description."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct turso_database_config_t {
    #[doc = " Parameter which defines who drives the IO - callee or the caller (non-zero parameter value interpreted as async IO)"]
    pub async_io: u64,
    #[doc = " Path to the database file or `:memory:`\n zero-terminated C string"]
    pub path: *const ::std::os::raw::c_char,
    #[doc = " Optional comma separated list of experimental features to enable\n zero-terminated C string or null pointer"]
    pub experimental_features: *const ::std::os::raw::c_char,
    #[doc = " optional VFS parameter explicitly specifying FS backend for the database.\n Available options are:\n - \"memory\": in-memory backend\n - \"syscall\": generic syscall backend\n - \"io_uring\": IO uring (supported only on Linux)\n - \"experimental_win_iocp\": Windows IOCP [experimental](supported only on Windows)"]
    pub vfs: *const ::std::os::raw::c_char,
    #[doc = " optional encryption cipher\n as encryption is experimental - experimental_features must have \"encryption\" in the list"]
    pub encryption_cipher: *const ::std::os::raw::c_char,
    #[doc = " optional encryption hexkey\n as encryption is experimental - experimental_features must have \"encryption\" in the list"]
    pub encryption_hexkey: *const ::std::os::raw::c_char,
}
impl Default for turso_database_config_t {
    fn default() -> Self {
        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
        unsafe {
            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
            s.assume_init()
        }
    }
}
unsafe extern "C" {
    #[doc = " Setup global database info"]
    pub fn turso_setup(
        config: *const turso_config_t,
        error_opt_out: *mut *const ::std::os::raw::c_char,
    ) -> turso_status_code_t;
}
unsafe extern "C" {
    #[doc = " Create database holder but do not open it"]
    pub fn turso_database_new(
        config: *const turso_database_config_t,
        database: *mut *const turso_database_t,
        error_opt_out: *mut *const ::std::os::raw::c_char,
    ) -> turso_status_code_t;
}
unsafe extern "C" {
    #[doc = " Open database\n  Can return TURSO_IO result if async_io=true is set"]
    pub fn turso_database_open(
        database: *const turso_database_t,
        error_opt_out: *mut *const ::std::os::raw::c_char,
    ) -> turso_status_code_t;
}
unsafe extern "C" {
    #[doc = " Connect to the database"]
    pub fn turso_database_connect(
        self_: *const turso_database_t,
        connection: *mut *mut turso_connection_t,
        error_opt_out: *mut *const ::std::os::raw::c_char,
    ) -> turso_status_code_t;
}
unsafe extern "C" {
    #[doc = " Set busy timeout for the connection"]
    pub fn turso_connection_set_busy_timeout_ms(self_: *const turso_connection_t, timeout_ms: i64);
}
unsafe extern "C" {
    #[doc = " Get autocommit state of the connection"]
    pub fn turso_connection_get_autocommit(self_: *const turso_connection_t) -> bool;
}
unsafe extern "C" {
    #[doc = " Get last insert rowid for the connection or 0 if no inserts happened before"]
    pub fn turso_connection_last_insert_rowid(self_: *const turso_connection_t) -> i64;
}
unsafe extern "C" {
    #[doc = " Register or replace a per-connection managed scalar function."]
    pub fn turso_connection_register_scalar_function(
        self_: *const turso_connection_t,
        name: *const ::std::os::raw::c_char,
        argc: i32,
        deterministic: bool,
        context: usize,
        callback: turso_scalar_function_t,
        context_destructor: turso_context_destructor_t,
        value_destructor: turso_value_destructor_t,
        error_opt_out: *mut *const ::std::os::raw::c_char,
    ) -> turso_status_code_t;
}
unsafe extern "C" {
    #[doc = " Register or replace a per-connection managed aggregate function."]
    pub fn turso_connection_register_aggregate_function(
        self_: *const turso_connection_t,
        name: *const ::std::os::raw::c_char,
        argc: i32,
        context: usize,
        init: turso_aggregate_init_function_t,
        step: turso_aggregate_step_function_t,
        finalize: turso_aggregate_final_function_t,
        context_destructor: turso_context_destructor_t,
        aggregate_destructor: turso_context_destructor_t,
        value_destructor: turso_value_destructor_t,
        error_opt_out: *mut *const ::std::os::raw::c_char,
    ) -> turso_status_code_t;
}
unsafe extern "C" {
    #[doc = " Unregister a per-connection managed scalar or aggregate function."]
    pub fn turso_connection_unregister_function(
        self_: *const turso_connection_t,
        name: *const ::std::os::raw::c_char,
        error_opt_out: *mut *const ::std::os::raw::c_char,
    ) -> turso_status_code_t;
}
unsafe extern "C" {
    #[doc = " Register or replace a per-connection managed collation."]
    pub fn turso_connection_register_collation(
        self_: *const turso_connection_t,
        name: *const ::std::os::raw::c_char,
        context: usize,
        callback: turso_collation_function_t,
        context_destructor: turso_context_destructor_t,
        error_opt_out: *mut *const ::std::os::raw::c_char,
    ) -> turso_status_code_t;
}
unsafe extern "C" {
    #[doc = " Unregister a per-connection managed collation."]
    pub fn turso_connection_unregister_collation(
        self_: *const turso_connection_t,
        name: *const ::std::os::raw::c_char,
        error_opt_out: *mut *const ::std::os::raw::c_char,
    ) -> turso_status_code_t;
}
unsafe extern "C" {
    #[doc = " Enable or disable SQL load_extension() for this connection."]
    pub fn turso_connection_enable_load_extension(
        self_: *const turso_connection_t,
        enabled: bool,
        error_opt_out: *mut *const ::std::os::raw::c_char,
    ) -> turso_status_code_t;
}
unsafe extern "C" {
    #[doc = " Load an extension library on this connection using Turso's native extension loader."]
    pub fn turso_connection_load_extension(
        self_: *const turso_connection_t,
        path: *const ::std::os::raw::c_char,
        error_opt_out: *mut *const ::std::os::raw::c_char,
    ) -> turso_status_code_t;
}
unsafe extern "C" {
    #[doc = " Prepare single statement in a connection"]
    pub fn turso_connection_prepare_single(
        self_: *const turso_connection_t,
        sql: *const ::std::os::raw::c_char,
        statement: *mut *mut turso_statement_t,
        error_opt_out: *mut *const ::std::os::raw::c_char,
    ) -> turso_status_code_t;
}
unsafe extern "C" {
    #[doc = " Prepare first statement in a string containing multiple statements in a connection"]
    pub fn turso_connection_prepare_first(
        self_: *const turso_connection_t,
        sql: *const ::std::os::raw::c_char,
        statement: *mut *mut turso_statement_t,
        tail_idx: *mut usize,
        error_opt_out: *mut *const ::std::os::raw::c_char,
    ) -> turso_status_code_t;
}
unsafe extern "C" {
    #[doc = " close the connection preventing any further operations executed over it\n caller still need to call deinit method to reclaim memory from the instance holding connection\n SAFETY: caller must guarantee that no ongoing operations are running over connection before calling turso_connection_close(...) method"]
    pub fn turso_connection_close(
        self_: *const turso_connection_t,
        error_opt_out: *mut *const ::std::os::raw::c_char,
    ) -> turso_status_code_t;
}
unsafe extern "C" {
    #[doc = " Execute single statement\n execute returns TURSO_DONE if execution completed\n execute returns TURSO_IO if async_io was set and execution needs IO in order to make progress"]
    pub fn turso_statement_execute(
        self_: *const turso_statement_t,
        rows_changes: *mut u64,
        error_opt_out: *mut *const ::std::os::raw::c_char,
    ) -> turso_status_code_t;
}
unsafe extern "C" {
    #[doc = " Step statement execution once\n Returns TURSO_DONE if execution finished\n Returns TURSO_ROW if execution generated the row (row values can be inspected with corresponding statement methods)\n Returns TURSO_IO if async_io was set and statement needs to execute IO to make progress"]
    pub fn turso_statement_step(
        self_: *const turso_statement_t,
        error_opt_out: *mut *const ::std::os::raw::c_char,
    ) -> turso_status_code_t;
}
unsafe extern "C" {
    #[doc = " Execute one iteration of underlying IO backend after TURSO_IO status code\n This function either return some ERROR status or TURSO_OK"]
    pub fn turso_statement_run_io(
        self_: *const turso_statement_t,
        error_opt_out: *mut *const ::std::os::raw::c_char,
    ) -> turso_status_code_t;
}
unsafe extern "C" {
    #[doc = " Reset a statement\n This method must be called in order to cleanup statement resources and prepare it for re-execution\n Any pending execution will be aborted - be careful and in certain cases ensure that turso_statement_finalize called before turso_statement_reset"]
    pub fn turso_statement_reset(
        self_: *const turso_statement_t,
        error_opt_out: *mut *const ::std::os::raw::c_char,
    ) -> turso_status_code_t;
}
unsafe extern "C" {
    #[doc = " Finalize a statement\n finalize returns TURSO_DONE if finalization completed\n This method must be called in the end of statement execution (either successfull or not)"]
    pub fn turso_statement_finalize(
        self_: *const turso_statement_t,
        error_opt_out: *mut *const ::std::os::raw::c_char,
    ) -> turso_status_code_t;
}
unsafe extern "C" {
    #[doc = " return amount of row modifications (insert/delete operations) made by the most recent executed statement"]
    pub fn turso_statement_n_change(self_: *const turso_statement_t) -> i64;
}
unsafe extern "C" {
    #[doc = " Get column count"]
    pub fn turso_statement_column_count(self_: *const turso_statement_t) -> i64;
}
unsafe extern "C" {
    #[doc = " Get the column name at the index\n C string allocated by Turso must be freed after the usage with corresponding turso_str_deinit(...) method"]
    pub fn turso_statement_column_name(
        self_: *const turso_statement_t,
        index: usize,
    ) -> *const ::std::os::raw::c_char;
}
unsafe extern "C" {
    #[doc = " Get the column declared type at the index (e.g. \"INTEGER\", \"TEXT\", \"DATETIME\", etc.)\n Returns NULL if the column type is not available.\n C string allocated by Turso must be freed after the usage with corresponding turso_str_deinit(...) method"]
    pub fn turso_statement_column_decltype(
        self_: *const turso_statement_t,
        index: usize,
    ) -> *const ::std::os::raw::c_char;
}
pub const turso_column_kind_t_TURSO_COLUMN_KIND_NONE: turso_column_kind_t = -1;
pub const turso_column_kind_t_TURSO_COLUMN_KIND_BUILTIN: turso_column_kind_t = 0;
pub const turso_column_kind_t_TURSO_COLUMN_KIND_CUSTOM: turso_column_kind_t = 1;
pub const turso_column_kind_t_TURSO_COLUMN_KIND_DOMAIN: turso_column_kind_t = 2;
pub const turso_column_kind_t_TURSO_COLUMN_KIND_STRUCT: turso_column_kind_t = 3;
pub const turso_column_kind_t_TURSO_COLUMN_KIND_UNION: turso_column_kind_t = 4;
#[doc = " Classification of a result column's declared type.\n\n Returned by turso_statement_column_kind. Values match the\n ColumnTypeKind variants in the Rust API and are kept stable: new kinds\n are appended."]
pub type turso_column_kind_t = ::std::os::raw::c_int;
unsafe extern "C" {
    #[doc = " Get the declared type name of the column at `index`.\n\n Returns the same string as turso_statement_column_decltype, but resolved\n through the richer type-info path so the result is consistent with the\n other turso_statement_column_* getters declared below.\n\n Returns NULL when no type info is available (statement finalized, index\n out of bounds, or the result column is not a direct table-column ref).\n C string allocated by Turso must be freed with turso_str_deinit."]
    pub fn turso_statement_column_declared_name(
        self_: *const turso_statement_t,
        index: usize,
    ) -> *const ::std::os::raw::c_char;
}
unsafe extern "C" {
    #[doc = " Get the array depth of the column at `index`.\n\n Returns 0 for scalar table columns, n for n-dimensional array columns\n (e.g. INTEGER[][] -> 2), and 0 when no type info is available. To\n distinguish \"scalar column\" from \"no info\", check\n turso_statement_column_kind first: it returns TURSO_COLUMN_KIND_NONE in\n the latter case."]
    pub fn turso_statement_column_array_dimensions(
        self_: *const turso_statement_t,
        index: usize,
    ) -> u32;
}
unsafe extern "C" {
    #[doc = " Get the underlying primitive type name for columns whose declared type\n is a CREATE TYPE or CREATE DOMAIN.\n\n Returns one of \"INTEGER\", \"TEXT\", \"REAL\", \"BLOB\", \"NUMERIC\". Returns NULL\n when the declared type is a built-in primitive directly, when no type\n info is available, or when the column is not a direct table-column\n reference. C string allocated by Turso must be freed with\n turso_str_deinit."]
    pub fn turso_statement_column_base_type(
        self_: *const turso_statement_t,
        index: usize,
    ) -> *const ::std::os::raw::c_char;
}
unsafe extern "C" {
    #[doc = " Classify the column's declared type as builtin / custom / domain /\n struct / union (see turso_column_kind_t).\n\n Returns TURSO_COLUMN_KIND_NONE when no type information is available."]
    pub fn turso_statement_column_kind(
        self_: *const turso_statement_t,
        index: usize,
    ) -> turso_column_kind_t;
}
unsafe extern "C" {
    #[doc = " Get the row value at the the index for a current statement state\n SAFETY: returned pointers will be valid only until next invocation of statement operation (step, finalize, reset, etc)\n Caller must make sure that any non-owning memory is copied appropriated if it will be used for longer lifetime"]
    pub fn turso_statement_row_value_kind(
        self_: *const turso_statement_t,
        index: usize,
    ) -> turso_type_t;
}
unsafe extern "C" {
    pub fn turso_statement_row_value_bytes_count(
        self_: *const turso_statement_t,
        index: usize,
    ) -> i64;
}
unsafe extern "C" {
    pub fn turso_statement_row_value_bytes_ptr(
        self_: *const turso_statement_t,
        index: usize,
    ) -> *const ::std::os::raw::c_char;
}
unsafe extern "C" {
    pub fn turso_statement_row_value_int(self_: *const turso_statement_t, index: usize) -> i64;
}
unsafe extern "C" {
    pub fn turso_statement_row_value_double(self_: *const turso_statement_t, index: usize) -> f64;
}
unsafe extern "C" {
    #[doc = " Return named argument position in a statement\nReturn positive integer with 1-indexed position if named parameter was found\nReturn -1 if parameter was not found"]
    pub fn turso_statement_named_position(
        self_: *const turso_statement_t,
        name: *const ::std::os::raw::c_char,
    ) -> i64;
}
unsafe extern "C" {
    #[doc = " Return parameters count for the statement\n -1 if pointer is invalid"]
    pub fn turso_statement_parameters_count(self_: *const turso_statement_t) -> i64;
}
unsafe extern "C" {
    #[doc = " Return the name of the parameter at 1-based index, including the SQL prefix.\nReturns NULL for positional-only parameters or out-of-range indices.\nThe caller must free the returned string with turso_str_deinit."]
    pub fn turso_statement_parameter_name(
        self_: *const turso_statement_t,
        index: i64,
    ) -> *const ::std::os::raw::c_char;
}
unsafe extern "C" {
    #[doc = " Bind a positional argument to a statement"]
    pub fn turso_statement_bind_positional_null(
        self_: *const turso_statement_t,
        position: usize,
    ) -> turso_status_code_t;
}
unsafe extern "C" {
    pub fn turso_statement_bind_positional_int(
        self_: *const turso_statement_t,
        position: usize,
        value: i64,
    ) -> turso_status_code_t;
}
unsafe extern "C" {
    pub fn turso_statement_bind_positional_double(
        self_: *const turso_statement_t,
        position: usize,
        value: f64,
    ) -> turso_status_code_t;
}
unsafe extern "C" {
    pub fn turso_statement_bind_positional_blob(
        self_: *const turso_statement_t,
        position: usize,
        ptr: *const ::std::os::raw::c_char,
        len: usize,
    ) -> turso_status_code_t;
}
unsafe extern "C" {
    pub fn turso_statement_bind_positional_text(
        self_: *const turso_statement_t,
        position: usize,
        ptr: *const ::std::os::raw::c_char,
        len: usize,
    ) -> turso_status_code_t;
}
unsafe extern "C" {
    #[doc = " Deallocate C string allocated by Turso"]
    pub fn turso_str_deinit(self_: *const ::std::os::raw::c_char);
}
unsafe extern "C" {
    #[doc = " Deallocate and close a database\n SAFETY: caller must ensure that no other code can concurrently or later call methods over deinited database"]
    pub fn turso_database_deinit(self_: *const turso_database_t);
}
unsafe extern "C" {
    #[doc = " Deallocate and close a connection\n SAFETY: caller must ensure that no other code can concurrently or later call methods over deinited connection"]
    pub fn turso_connection_deinit(self_: *const turso_connection_t);
}
unsafe extern "C" {
    #[doc = " Deallocate and close a statement\n SAFETY: caller must ensure that no other code can concurrently or later call methods over deinited statement"]
    pub fn turso_statement_deinit(self_: *const turso_statement_t);
}