Struct lumus_sql_builder::sqlite::Column

source ·
pub struct Column { /* private fields */ }
Expand description

Represents a table column with a name, data type, and options.

Implementations§

source§

impl Column

source

pub fn new(name: &str) -> Column

Creates a new Column instance with the given column name.

§Example
use lumus_sql_builder::sqlite::Column;
Column::new("name").text().not_null();
source

pub fn integer(self) -> Self

Specifies that the column has an INTEGER data type.

source

pub fn text(self) -> Self

Specifies that the column has a TEXT data type.

source

pub fn real(self) -> Self

Specifies that the column has a REAL data type.

source

pub fn boolean(self) -> Self

Specifies that the column has a BOOLEAN data type.

source

pub fn blob(self) -> Self

Specifies that the column has a BLOB data type.

source

pub fn numeric(self) -> Self

Specifies that the column has a NUMERIC data type.

source

pub fn date(self) -> Self

Specifies that the column has a DATE data type.

source

pub fn time(self) -> Self

Specifies that the column has a TIME data type.

source

pub fn datetime(self) -> Self

Specifies that the column has a DATETIME data type.

source

pub fn not_null(self) -> Self

Specifies that the column cannot have NULL values.

source

pub fn unique(self) -> Self

Specifies that the column values must be unique across rows.

source

pub fn default(self, value: &str) -> Self

Specifies a default value for the column.

source

pub fn auto_increment(self) -> Self

Specifies that the column values should auto-increment.

source

pub fn primary_key(self) -> Self

Specifies that the column is a primary key.

source

pub fn build(&self) -> Result<String, SqlBuilderError>

Builds and returns the SQL representation of the column.

Trait Implementations§

source§

impl Debug for Column

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Display for Column

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Column

§

impl RefUnwindSafe for Column

§

impl Send for Column

§

impl Sync for Column

§

impl Unpin for Column

§

impl UnwindSafe for Column

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.