pub struct Index {
pub name: String,
pub table: String,
pub columns: Vec<String>,
pub unique: bool,
pub method: IndexMethod,
pub where_clause: Option<CheckExpr>,
pub include: Vec<String>,
pub concurrently: bool,
pub expressions: Vec<String>,
}Expand description
An index definition.
Fields§
§name: StringIndex name.
table: StringTable the index belongs to.
columns: Vec<String>Columns covered by the index.
unique: boolWhether the index enforces uniqueness.
method: IndexMethodIndex method (Phase 4): btree, hash, gin, gist, brin
where_clause: Option<CheckExpr>Partial index WHERE clause
include: Vec<String>INCLUDE columns (covering index)
concurrently: boolCREATE CONCURRENTLY
expressions: Vec<String>Expression columns (e.g. (lower(email))) — if set, these replace columns
Implementations§
Source§impl Index
impl Index
Sourcepub fn new(
name: impl Into<String>,
table: impl Into<String>,
columns: Vec<String>,
) -> Self
pub fn new( name: impl Into<String>, table: impl Into<String>, columns: Vec<String>, ) -> Self
Create a new index on the given columns.
Sourcepub fn expression(
name: impl Into<String>,
table: impl Into<String>,
expressions: Vec<String>,
) -> Self
pub fn expression( name: impl Into<String>, table: impl Into<String>, expressions: Vec<String>, ) -> Self
Create an expression index (e.g. CREATE INDEX ON t ((lower(email))))
Sourcepub fn using(self, method: IndexMethod) -> Self
pub fn using(self, method: IndexMethod) -> Self
Set index method (USING clause)
Sourcepub fn concurrently(self) -> Self
pub fn concurrently(self) -> Self
Create index CONCURRENTLY
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Index
impl RefUnwindSafe for Index
impl Send for Index
impl Sync for Index
impl Unpin for Index
impl UnsafeUnpin for Index
impl UnwindSafe for Index
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