mirror of
https://github.com/clockworklabs/SpacetimeDB.git
synced 2026-05-12 18:57:51 -04:00
cd1ec90d16
# Description of Changes This PR renames the templates to always use shorthand for the language, specify a framework (or console) if necessary, and shorten the naming in general # Expected complexity level and risk 1 # Testing I've tested generating templates manually --------- Co-authored-by: clockwork-labs-bot <clockwork-labs-bot@users.noreply.github.com>
27 lines
592 B
C#
27 lines
592 B
C#
using SpacetimeDB;
|
|
|
|
public static partial class Module
|
|
{
|
|
[SpacetimeDB.Table(Name = "Person", Public = true)]
|
|
public partial struct Person
|
|
{
|
|
public string Name;
|
|
}
|
|
|
|
[SpacetimeDB.Reducer]
|
|
public static void Add(ReducerContext ctx, string name)
|
|
{
|
|
ctx.Db.Person.Insert(new Person { Name = name });
|
|
}
|
|
|
|
[SpacetimeDB.Reducer]
|
|
public static void SayHello(ReducerContext ctx)
|
|
{
|
|
foreach (var person in ctx.Db.Person.Iter())
|
|
{
|
|
Log.Info($"Hello, {person.Name}!");
|
|
}
|
|
Log.Info("Hello, World!");
|
|
}
|
|
}
|