diff --git a/examples/query/src/index.ts b/examples/query/src/index.ts index cb796b6cda..6f2e04e8ce 100644 --- a/examples/query/src/index.ts +++ b/examples/query/src/index.ts @@ -1,37 +1,7 @@ -import { - Canister, - ic, - Opt, - query, - Record, - StableBTreeMap, - text, - update, - Vec, - Void -} from 'azle'; - -const Entry = Record({ - key: text, - value: text -}); - -let db = StableBTreeMap(0); +import { Canister, query, text } from 'azle'; export default Canister({ - get: query([text], Opt(text), (key) => { - return db.get(key); - }), - set: update([text, text], Void, (key, value) => { - db.insert(key, value); - }), - setMany: update([Vec(Entry)], Void, (entries) => { - entries.forEach((entry) => { - if (entry.key === 'trap') { - ic.trap('explicit trap'); - } - - db.insert(entry.key, entry.value); - }); + simpleQuery: query([], text, () => { + return 'This is a query function'; }) });