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
use arrayvec::ArrayString;
use core::{array, marker::PhantomData};
use crate::{Associations, FullAssociation, SqlWriter};
#[derive(Debug)]
pub struct NoAssociation<E>(PhantomData<E>);
impl<E> NoAssociation<E> {
#[inline]
pub const fn new() -> Self {
Self(PhantomData)
}
}
impl<E> Associations for (NoAssociation<E>,) {
type FullAssociations<'x> = array::IntoIter<FullAssociation<'x>, 0>;
#[inline]
fn full_associations(&self) -> Self::FullAssociations<'_> {
[].into_iter()
}
}
impl<E, const N: usize> SqlWriter<N> for (NoAssociation<E>,)
where
E: From<crate::Error>,
{
type Error = E;
#[inline]
fn write_select(&self, _: &mut ArrayString<N>, _: &str) -> Result<(), Self::Error> {
Ok(())
}
#[inline]
fn write_select_associations(&self, _: &mut ArrayString<N>) -> Result<(), Self::Error> {
Ok(())
}
#[inline]
fn write_select_fields(&self, _: &mut ArrayString<N>) -> Result<(), Self::Error> {
Ok(())
}
#[inline]
fn write_select_orders_by(&self, _: &mut ArrayString<N>) -> Result<(), Self::Error> {
Ok(())
}
}