pub struct VarCharDataType {
pub max_length: Option<u32>,
pub encoding: StringEncoding,
}Expand description
Variable-length character string with optional max length.
Maps to: VARCHAR(n) (PostgreSQL, SQL Server, Snowflake), STRING (Databricks, ClickHouse).
§Example
use razeri_plugin_contract::data_type::{VarCharDataType, StringEncoding};
// Fixed max length
let varchar = VarCharDataType::new(255);
assert_eq!(varchar.max_length, Some(255));
// Unlimited length (TEXT/VARCHAR(MAX)/STRING)
let text = VarCharDataType::unlimited();
assert_eq!(text.max_length, None);
// Explicit ASCII encoding
let ascii = VarCharDataType::with_encoding(Some(100), StringEncoding::Ascii);Fields§
§max_length: Option<u32>Maximum length in characters (None = unlimited/MAX).
Platform limits:
PostgreSQL: up to 10,485,760- SQL Server: up to 8,000 (or MAX)
- Snowflake: up to 16,777,216
ClickHouse: unlimited
encoding: StringEncodingCharacter encoding (default: Unicode).
Implementations§
Source§impl VarCharDataType
impl VarCharDataType
Sourcepub fn new(max_length: u32) -> Self
pub fn new(max_length: u32) -> Self
Creates a VARCHAR with specified max length.
§Example
use razeri_plugin_contract::data_type::VarCharDataType;
let varchar = VarCharDataType::new(100);
assert_eq!(varchar.max_length, Some(100));Sourcepub fn unlimited() -> Self
pub fn unlimited() -> Self
Creates an unlimited length text type (VARCHAR(MAX), TEXT, STRING).
§Example
use razeri_plugin_contract::data_type::VarCharDataType;
let text = VarCharDataType::unlimited();
assert_eq!(text.max_length, None);Sourcepub fn with_encoding(max_length: Option<u32>, encoding: StringEncoding) -> Self
pub fn with_encoding(max_length: Option<u32>, encoding: StringEncoding) -> Self
Creates a VARCHAR with the specified length and encoding.
§Example
use razeri_plugin_contract::data_type::{VarCharDataType, StringEncoding};
let ascii = VarCharDataType::with_encoding(Some(50), StringEncoding::Ascii);
assert_eq!(ascii.max_length, Some(50));
assert_eq!(ascii.encoding, StringEncoding::Ascii);Trait Implementations§
Source§impl Clone for VarCharDataType
impl Clone for VarCharDataType
Source§fn clone(&self) -> VarCharDataType
fn clone(&self) -> VarCharDataType
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for VarCharDataType
impl Debug for VarCharDataType
impl Eq for VarCharDataType
Source§impl Hash for VarCharDataType
impl Hash for VarCharDataType
Source§impl PartialEq for VarCharDataType
impl PartialEq for VarCharDataType
impl StructuralPartialEq for VarCharDataType
Auto Trait Implementations§
impl Freeze for VarCharDataType
impl RefUnwindSafe for VarCharDataType
impl Send for VarCharDataType
impl Sync for VarCharDataType
impl Unpin for VarCharDataType
impl UnsafeUnpin for VarCharDataType
impl UnwindSafe for VarCharDataType
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more