Macro microrm_macros::make_index
source · make_index!() { /* proc-macro */ }
Expand description
Defines a struct to represent a optionally-unique index on a table.
Suppose the following Entity
definition is used:
ⓘ
#[derive(Entity,Serialize,Deserialize)]
struct SystemUser {
username: String,
hashed_password: String
}
We can now use make_index!
to define an index on the username field:
ⓘ
make_index!(SystemUsernameIndex, SystemUserColumns::Username)
This index can be made unique by adding a !
prior to the type name, as:
ⓘ
make_index!(!SystemUsernameUniqueIndex, SystemUserColumns::Username)