Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 1 addition & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,39 +35,7 @@ Add the schema generation script to your `package.json`:
}
```

### Use Zero schema file

Use the generated Zero schema:

```tsx
import {useEffect, useState} from 'react';
import {useZero} from '@rocicorp/zero/react';
import {syncedQuery} from '@rocicorp/zero';
import {zql} from '../zero-schema.gen.ts';

const postsQuery = syncedQuery('allPosts', z.tuple([]), () =>
zql.posts.related('author').limit(10),
);

function PostList() {
const z = useZero();

const [posts] = useQuery(postsQuery());

return (
<div>
{posts.map(post => (
<div key={post.id} className="post">
{/* Access the JSON content from Drizzle */}
<p>{post.content.textValue}</p>
<p>By: {post.author?.name}</p>
<p>Email: {post.author?.email}</p>
</div>
))}
</div>
);
}
```
Please reference the Zero docs for how to use your new Zero schema: [https://zero.rocicorp.dev/docs/reading-data](https://zero.rocicorp.dev/docs/reading-data).

## Postgres Array Support

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "prisma-zero",
"version": "0.1.0-canary.0",
"version": "0.1.0-canary.1",
"description": "Generate Zero schemas from Prisma ORM schemas",
"type": "module",
"scripts": {
Expand Down