Skip to content

Commit

Permalink
Review Feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
lcodes committed Sep 20, 2024
1 parent 79e4162 commit 7180d99
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 8 deletions.
4 changes: 2 additions & 2 deletions crates/bindings-csharp/Runtime/Attrs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ public static class ReducerKind
}

[AttributeUsage(AttributeTargets.Method, Inherited = false)]
public sealed class ReducerAttribute : Attribute
public sealed class ReducerAttribute(string? name = null) : Attribute
{
public string? Name;
public string? Name => name;
}


Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions modules/sdk-test-connect-disconnect-cs/Lib.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ public partial struct Disconnected {

static partial class Module
{
[SpacetimeDB.Reducer(Name = ReducerKind.Connect)]
[SpacetimeDB.Reducer(ReducerKind.Connect)]
public static void OnConnect(ReducerContext ctx)
{
var row = new Connected { identity = ctx.Sender };
ctx.Db.Connected.Insert(ref row);
}

[SpacetimeDB.Reducer(Name = ReducerKind.Disconnect)]
[SpacetimeDB.Reducer(ReducerKind.Disconnect)]
public static void OnDisconnect(ReducerContext ctx)
{
var row = new Disconnected { identity = ctx.Sender };
Expand Down
6 changes: 3 additions & 3 deletions modules/spacetimedb-quickstart-cs/Lib.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ public partial struct Person {

static partial class Module
{
[Reducer(Name = "add")]
[Reducer("add")]
public static void Add(ReducerContext ctx, string name, byte age)
{
var row = new Person { Name = name, Age = age };
ctx.Db.Person.Insert(ref row);
}

[Reducer(Name = "say_hello")]
[Reducer("say_hello")]
public static void SayHello(ReducerContext ctx)
{
foreach (var person in ctx.Db.Person.Iter())
Expand All @@ -30,7 +30,7 @@ public static void SayHello(ReducerContext ctx)
Runtime.Log("Hello, World!");
}

[Reducer(Name = "list_over_age")]
[Reducer("list_over_age")]
public static void ListOverAge(ReducerContext ctx, byte age)
{
foreach (var person in ctx.Db.Person.Query(person => person.Age >= age))
Expand Down

0 comments on commit 7180d99

Please sign in to comment.