Skip to content

Commit

Permalink
Regenerate quickstart client
Browse files Browse the repository at this point in the history
  • Loading branch information
RReverser committed May 22, 2024
1 parent 25edaff commit 12544bb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions examples/quickstart/client/module_bindings/Message.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,17 @@ public static IEnumerable<Message> Iter()
{
return SpacetimeDBClient.clientDB.GetObjects("Message").Cast<Message>();
}

public static IEnumerable<Message> Query(Func<Message, bool> filter)
{
return Iter().Where(filter);
}

public static int Count()
{
return SpacetimeDBClient.clientDB.Count("Message");
}

public static IEnumerable<Message> FilterBySender(SpacetimeDB.Identity value)
{
return Query(x => x.Sender == value);
Expand Down
5 changes: 4 additions & 1 deletion examples/quickstart/client/module_bindings/User.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public partial class User : IDatabaseTable
[Newtonsoft.Json.JsonProperty("online")]
public bool Online;

private static Dictionary<SpacetimeDB.Identity, User> Identity_Index = new Dictionary<SpacetimeDB.Identity, User>(16);
private static Dictionary<SpacetimeDB.Identity, User> Identity_Index = new(16);

private static void InternalOnValueInserted(object insertedValue)
{
Expand Down Expand Up @@ -67,14 +67,17 @@ public static IEnumerable<User> Iter()
{
return SpacetimeDBClient.clientDB.GetObjects("User").Cast<User>();
}

public static IEnumerable<User> Query(Func<User, bool> filter)
{
return Iter().Where(filter);
}

public static int Count()
{
return SpacetimeDBClient.clientDB.Count("User");
}

public static User FindByIdentity(SpacetimeDB.Identity value)
{
Identity_Index.TryGetValue(value, out var r);
Expand Down

0 comments on commit 12544bb

Please sign in to comment.