Skip to main content

sqlx_cloudflare_d1/
column.rs

1use sqlx_core::column::Column;
2
3use crate::{D1TypeInfo, D1};
4
5/// A column of a D1 result.
6#[derive(Debug, Clone)]
7pub struct D1Column {
8    pub(crate) name: String,
9    pub(crate) ordinal: usize,
10    /// The type of the column's first non-NULL value, or `Null` if it has
11    /// none -- D1 reports no declared types (see [`D1TypeInfo`]).
12    pub(crate) type_info: D1TypeInfo,
13}
14
15impl Column for D1Column {
16    type Database = D1;
17
18    fn ordinal(&self) -> usize {
19        self.ordinal
20    }
21
22    fn name(&self) -> &str {
23        &self.name
24    }
25
26    fn type_info(&self) -> &D1TypeInfo {
27        &self.type_info
28    }
29}