This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ curl -d '{"title": "my first post", "markdown": "Here is our first post"}' http://localhost:8080/dev/posts | |
{ | |
"id": "19a43957-ef7f-4ebd-8096-2d7e37494e2a", | |
"title": "my first post", | |
"markdown": "Here is our first post" | |
} | |
$ curl -d '{"title": "my second post", "markdown": "Here is our second post"}' http://localhost:8080/dev/posts | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ npm install # install remix' npm packages | |
$ cp .env.example .env # uses the example environment variables, good enough for testing | |
$ npm run dev # runs the Remix development server, and also starts ChiselStrike |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Post } from "../models/Post.ts"; | |
export default Post.crud(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ChiselEntity } from "@chiselstrike/api"; | |
export class Post extends ChiselEntity { | |
title: string; | |
markdown: string; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[op] | |
fn op_chisel_relational_query_create( | |
op_state: &mut OpState, | |
op_chain: QueryOpChain, | |
context: ChiselRequestContext, | |
) -> Result<ResourceId> { | |
let query_plan = QueryPlan::from_op_chain( | |
&RequestContext::new( | |
current_policies(op_state), | |
current_type_system(op_state), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Client } from "../models/Client"; | |
import { Entry } from "../models/Entry"; | |
import { Space } from "../models/Space"; | |
type UserValue = { | |
op: 'del'; | |
key: string; | |
} | { | |
op: 'put'; | |
key: string; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const todos = useSubscribe(rep, async tx => { | |
return await tx.scan({prefix: 'todo/'}).toArray(); | |
}); | |
return ( | |
<ul> | |
{todos.map(todo => ( | |
<li key={todo.id}>{todo.text}</li> | |
))} | |
</ul> | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {Replicache} from "replicache"; | |
const rep = new Replicache({ | |
pushURL: '/api/replicache-push', | |
pullURL: '/api/replicache-pull', | |
... | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
f: | |
xor eax, eax ; exclusive-or to return register | |
ret |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
f: | |
push rbp ; push register into the stack | |
mov rbp, rsp ; adjust the stack pointer | |
mov eax, 0 ; set the return register to 0 | |
pop rbp ; pop the stack | |
ret ; return |