From d1e3865115aa5f27c6c75e8061277e898d155210 Mon Sep 17 00:00:00 2001 From: Vincent Rischmann Date: Sat, 14 Dec 2024 01:38:19 +0100 Subject: readme: fix examples --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index afc1cd1..c58434e 100644 --- a/README.md +++ b/README.md @@ -625,12 +625,14 @@ try db.createAggregateFunction( "mySum", &my_ctx, struct { - fn step(ctx: *MyContext, input: u32) void { + fn step(fctx: sqlite.FunctionContext, input: u32) void { + var ctx = fctx.userContext(*MyContext) orelse return; ctx.sum += input; } }.step, struct { - fn finalize(ctx: *MyContext) u32 { + fn finalize(fctx: sqlite.FunctionContext) u32 { + const ctx = fctx.userContext(*MyContext) orelse return 0; return ctx.sum; } }.finalize, -- cgit v1.2.3