Skip to content

Commit

Permalink
Update crates/bindings-macro/src/lib.rs
Browse files Browse the repository at this point in the history
Co-authored-by: Kim Altintop <kim@eagain.io>
Signed-off-by: Mazdak Farrokhzad <twingoow@gmail.com>
  • Loading branch information
Centril and kim authored Jul 6, 2023
1 parent 6204a75 commit da45156
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions crates/bindings-macro/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -472,9 +472,21 @@ fn spacetimedb_table(item: TokenStream) -> syn::Result<TokenStream> {
/// Among other things, this derives `Serialize`, `Deserialize`,
/// `SpacetimeType`, and `TableType` for our type.
///
/// Note that using `#[autoinc]` on a field
/// does not also imply `#[primarykey]` or `#[unique]`.
/// If those semantics are desired, those attributes should also be used.
/// A table type must be a struct, whose fields may be annotated with the following attributes:
///
/// * `#[autoinc]`
///
/// Creates a database sequence. When a row is inserted with the annotated field
/// set to `0` (zero), the sequence is incremented, and this value used instead.
/// Can only be used on numeric types, and may be combined with indexes.
///
/// * `#[unique]`
///
/// Creates an index and unique constraint for the annotated field.
///
/// * `#[primarykey]`
///
/// Similar to `#[unique]`, but generates additional CRUD methods.
#[proc_macro_derive(TableType, attributes(sats, unique, autoinc, primarykey))]
pub fn spacetimedb_tabletype(item: proc_macro::TokenStream) -> proc_macro::TokenStream {
let item = syn::parse_macro_input!(item as syn::DeriveInput);
Expand Down

0 comments on commit da45156

Please sign in to comment.