- 
                Notifications
    You must be signed in to change notification settings 
- Fork 645
Open
Description
use spacetimedb::Uuid;
#[table(name = foobar)]
struct Foobar {
    uuid: Uuid,
}
#[reducer]
fn baz(ctx: &ReducerContext) {
    ctx.db.foobar.insert(Foobar {
        uuid: ctx.uuidv7(),
    });
}using SpacetimeDB; // hypothetical namespace for Uuid, reducer, etc.
[Table("foobar")]
public class Foobar
{
    public Uuid Uuid { get; set; }
}
public static class Module
{
    [Reducer("baz")]
    public static void Baz(ReducerContext ctx)
    {
        ctx.Db.Foobar.Insert(new Foobar
        {
            Uuid = ctx.Uuidv7()
        });
    }
}import { Uuid, table, reducer, ReducerContext } from "spacetimedb";
interface Foobar {
  uuid: Uuid;
}
table("foobar", {
  uuid: "uuid",
});
reducer("baz", (ctx: ReducerContext) => {
  ctx.db.foobar.insert({
    uuid: ctx.uuidv7(),
  } as Foobar);
});See also:
Metadata
Metadata
Assignees
Labels
No labels