Skip to main content

NAME

Constant NAME 

Source
pub const NAME: NameMarker;
Expand description

Sets the name used in the database.

By default, table, view and column names are the snake_case form of the Rust struct or field name. name overrides that.

§Column Example

// Column `created_at` by default; stored as `creation_timestamp` here.
#[column(name = "creation_timestamp")]
created_at: DateTime<Utc>,

§Table Example

// Struct `UserAccount` becomes table `user_account` by default
struct UserAccount { ... }

// Override with custom name:
#[SQLiteTable(name = "user_accounts")]
struct UserAccount { ... }

§View Example

#[SQLiteView(NAME = "active_users")]
struct ActiveUsers { ... }