megadex_derive

Crates.iomegadex_derive
lib.rsmegadex_derive
version0.1.0
sourcesrc
created_at2019-01-17 01:37:48.588434
updated_at2019-01-17 01:37:48.588434
descriptionSyntactic sugar for managing collections of structs which have multiple indexed accessors.
homepagehttps://github.com/rrichardson/megadex
repositoryhttps://github.com/rrichardson/megadex
max_upload_size
id109057
size13,786
Rick Richardson (rrichardson)

documentation

README

Megadex Derive

Build Status Build status

A procedural macro which provides a Derive trait called Megadex

This provides the use of two field-level attributes: #[id] and #[indexed]

You use id to indicate which field in your struct contains the primary key.

You use indexed to indicate any fields by which you want to retrieve this (and other) struct(s)

Usage:


#[derive(Megadex)]
struct Foo {
  #[id]
  my_id: String,
  weeee: String,
  #[indexed]
  bar: String,

  #[indexed]
  baz: String,
}

// This would add these methods to your struct: 

fn save(&self)

fn insert(id, other)

fn erase(&self)

fn del(id, other) 

fn get(id, other)

fn find_by_bar(key: &String)

fn id_by_bar(key: &String)

fn find_by_baz(key: &String)

fn id_by_bar(key: &String)

Commit count: 29

cargo fmt