Skip to content

Commit

Permalink
Revert accidental change
Browse files Browse the repository at this point in the history
This was accidentally updated in 3b9e879
  • Loading branch information
dansteren committed Dec 18, 2023
1 parent 050d137 commit 9441406
Showing 1 changed file with 3 additions and 33 deletions.
36 changes: 3 additions & 33 deletions examples/query/src/index.ts
Original file line number Diff line number Diff line change
@@ -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<text, text>(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';
})
});

0 comments on commit 9441406

Please sign in to comment.