Macro light_magic::db

source ·
db!() { /* proc-macro */ }
Expand description

Creates the Database struct with the fitting logic

§Functions

  • insert_#table
  • get_#table
  • edit_#table
  • delete_#table
  • search_#table

§Example

use light_magic::db;

db! {
    // `users` is the table name
    // `{...}` is the table data
    // the first field, like here `name`, is the `primary_key`
    user => { id: usize, name: String, kind: String },
    // using [...] after the table name you can add your own derives
    // like here `PartialEq`
    criminal: [PartialEq] => { user_name: String, entry: String }
}