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

Method init

modules/module-test-cs/Lib.cs:238–258  ·  view source on GitHub ↗

This reducer is run at module initialization.

(ReducerContext ctx)

Source from the content-addressed store, hash-verified

236
237 // This reducer is run at module initialization.
238 [Reducer(ReducerKind.Init)]
239 public static void init(ReducerContext ctx)
240 {
241 ctx.Db.repeating_test_arg.Insert(new RepeatingTestArg
242 {
243 prev_time = ctx.Timestamp,
244 scheduled_id = 0,
245 scheduled_at = new TimeDuration(1000000)
246 });
247
248 var currentTime = ctx.Timestamp;
249 var oneSeconds = new TimeDuration { Microseconds = 1_000_000 };
250 var futureTimestamp = currentTime + oneSeconds;
251
252 ctx.Db.nonrepeating_test_arg.Insert(new NonrepeatingTestArg
253 {
254 prev_time = ctx.Timestamp,
255 scheduled_id = 0,
256 scheduled_at = new ScheduleAt.Time(futureTimestamp)
257 });
258 }
259
260 [Reducer]
261 public static void repeating_test(ReducerContext ctx, RepeatingTestArg arg)

Callers 1

index.tsFile · 0.45

Calls 1

InsertMethod · 0.45

Tested by

no test coverage detected