pub struct CharDataType {
pub length: u32,
pub encoding: StringEncoding,
}Expand description
Fixed-length character string.
Maps to: CHAR(n) (PostgreSQL, SQL Server, Snowflake), FixedString(n) (ClickHouse).
Note: Databricks does not have a fixed-length char type.
§Example
use razeri_plugin_contract::data_type::{CharDataType, StringEncoding};
// Default: Unicode encoding
let char_type = CharDataType::new(50);
assert_eq!(char_type.length, 50);
// Explicit ASCII encoding
let ascii_char = CharDataType::with_encoding(10, StringEncoding::Ascii);Fields§
§length: u32Fixed length in characters (1-8000 for SQL Server, 1-16777216 for Snowflake).
encoding: StringEncodingCharacter encoding (default: Unicode).
Implementations§
Source§impl CharDataType
impl CharDataType
Sourcepub fn new(length: u32) -> Self
pub fn new(length: u32) -> Self
Creates a fixed-length character string with Unicode encoding.
§Example
use razeri_plugin_contract::data_type::CharDataType;
let char = CharDataType::new(100);
assert_eq!(char.length, 100);Sourcepub fn with_encoding(length: u32, encoding: StringEncoding) -> Self
pub fn with_encoding(length: u32, encoding: StringEncoding) -> Self
Creates a fixed-length character string with the specified encoding.
§Example
use razeri_plugin_contract::data_type::{CharDataType, StringEncoding};
let ascii = CharDataType::with_encoding(20, StringEncoding::Ascii);
assert_eq!(ascii.encoding, StringEncoding::Ascii);Trait Implementations§
Source§impl Clone for CharDataType
impl Clone for CharDataType
Source§fn clone(&self) -> CharDataType
fn clone(&self) -> CharDataType
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 CharDataType
impl Debug for CharDataType
impl Eq for CharDataType
Source§impl Hash for CharDataType
impl Hash for CharDataType
Source§impl PartialEq for CharDataType
impl PartialEq for CharDataType
impl StructuralPartialEq for CharDataType
Auto Trait Implementations§
impl Freeze for CharDataType
impl RefUnwindSafe for CharDataType
impl Send for CharDataType
impl Sync for CharDataType
impl Unpin for CharDataType
impl UnsafeUnpin for CharDataType
impl UnwindSafe for CharDataType
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