pub struct PgIndex { /* private fields */ }Expand description
PostgreSQL index metadata without SQL generation or execution.
Implementations§
Source§impl PgIndex
impl PgIndex
Sourcepub const fn new(name: PgIndexName) -> Self
pub const fn new(name: PgIndexName) -> Self
Creates index metadata from a name.
Sourcepub fn with_table(self, table: PgTableRef) -> Self
pub fn with_table(self, table: PgTableRef) -> Self
Sets the table reference.
Sourcepub const fn with_method(self, method: PgIndexMethod) -> Self
pub const fn with_method(self, method: PgIndexMethod) -> Self
Sets the index method.
Sourcepub fn with_columns(self, columns: Vec<PgIndexColumn>) -> Self
pub fn with_columns(self, columns: Vec<PgIndexColumn>) -> Self
Sets indexed columns.
Sourcepub fn with_expression(self, expression: PgIndexExpression) -> Self
pub fn with_expression(self, expression: PgIndexExpression) -> Self
Adds an index expression label and marks the index as expression-backed.
Sourcepub fn with_predicate(
self,
predicate: impl AsRef<str>,
) -> Result<Self, PgIndexError>
pub fn with_predicate( self, predicate: impl AsRef<str>, ) -> Result<Self, PgIndexError>
Sets a partial-index predicate label without parsing SQL.
§Errors
Returns PgIndexError when the label is empty or contains control characters.
Sourcepub const fn with_flags(self, flags: PgIndexFlags) -> Self
pub const fn with_flags(self, flags: PgIndexFlags) -> Self
Sets index flags.
Sourcepub const fn name(&self) -> &PgIndexName
pub const fn name(&self) -> &PgIndexName
Returns the index name.
Sourcepub const fn table(&self) -> Option<&PgTableRef>
pub const fn table(&self) -> Option<&PgTableRef>
Returns the optional table reference.
Sourcepub const fn method(&self) -> PgIndexMethod
pub const fn method(&self) -> PgIndexMethod
Returns the index method.
Sourcepub fn columns(&self) -> &[PgIndexColumn]
pub fn columns(&self) -> &[PgIndexColumn]
Returns indexed columns.
Sourcepub fn expressions(&self) -> &[PgIndexExpression]
pub fn expressions(&self) -> &[PgIndexExpression]
Returns expression labels.
Sourcepub const fn flags(&self) -> PgIndexFlags
pub const fn flags(&self) -> PgIndexFlags
Returns the index flags.
Trait Implementations§
Source§impl Ord for PgIndex
impl Ord for PgIndex
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialOrd for PgIndex
impl PartialOrd for PgIndex
impl Eq for PgIndex
impl StructuralPartialEq for PgIndex
Auto Trait Implementations§
impl Freeze for PgIndex
impl RefUnwindSafe for PgIndex
impl Send for PgIndex
impl Sync for PgIndex
impl Unpin for PgIndex
impl UnsafeUnpin for PgIndex
impl UnwindSafe for PgIndex
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