Skip to main content

drizzle_core/
builder.rs

1use crate::{OrderBy, SQL, traits::SQLParam};
2
3/// Marker trait for executable builder states.
4///
5/// This is an extension point for driver crates to opt in builder state
6/// markers that represent complete, executable queries (for example, to
7/// enable set operations or prepared statements on those states).
8pub trait ExecutableState {}
9
10#[derive(Debug, Clone)]
11pub struct BuilderInit;
12
13impl ExecutableState for BuilderInit {}
14
15/// Represents an ORDER BY clause in a query.
16#[derive(Debug, Clone)]
17pub struct OrderByClause<'a, V: SQLParam> {
18    /// The expression to order by.
19    pub expr: SQL<'a, V>,
20    /// The direction to sort (ASC or DESC).
21    pub direction: OrderBy,
22}
23
24impl<'a, V: SQLParam> OrderByClause<'a, V> {
25    /// Creates a new ORDER BY clause.
26    pub const fn new(expr: SQL<'a, V>, direction: OrderBy) -> Self {
27        Self { expr, direction }
28    }
29}