MCPcopy Create free account
hub / github.com/clockworklabs/SpacetimeDB / User_OnUpdate

Function User_OnUpdate

templates/chat-console-cs/Program.cs:113–130  ·  view source on GitHub ↗
(EventContext ctx, User oldValue, User newValue)

Source from the content-addressed store, hash-verified

111/// Our `User.OnUpdate` callback:
112/// print a notification about name and status changes.
113void User_OnUpdate(EventContext ctx, User oldValue, User newValue)
114{
115 if (oldValue.Name != newValue.Name)
116 {
117 Console.WriteLine($"{UserNameOrIdentity(oldValue)} renamed to {newValue.Name}");
118 }
119 if (oldValue.Online != newValue.Online)
120 {
121 if (newValue.Online)
122 {
123 Console.WriteLine($"{UserNameOrIdentity(newValue)} connected.");
124 }
125 else
126 {
127 Console.WriteLine($"{UserNameOrIdentity(newValue)} disconnected.");
128 }
129 }
130}
131
132/// Our `Message.OnInsert` callback: print new messages.
133void Message_OnInsert(EventContext ctx, Message insertedValue)

Callers

nothing calls this directly

Calls 1

UserNameOrIdentityFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…