Skip to content

Commit 3a6fa62

Browse files
committed
update
1 parent e639c47 commit 3a6fa62

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

blog/check-function/index.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ model Todo {
5151
}
5252
```
5353

54-
As you can easily spot, the access policies for `Todo` are almost identical to those for `List`. The duplication is not only tedious to write but also error-prone to maintain. If you ever need to change the policy, you have to remember to update it in two places.
54+
As you can easily spot, the access policies for `Todo` are almost identical to those for `List`. The duplication is not only tedious to write but also error-prone to maintain. If you ever need to change the policy, you have to remember to update it in two places. In a real application, the rules will be more complex, and as a result, the duplication will be more severe and can sometimes get several level deep.
5555

5656
The key to the problem is that from the access control point of view, the child model `Todo` simply "follows" the parent model `List`, which is a typical pattern in many applications. We can avoid duplication if we had a way to "delegate" the check of the child model to its parent.
5757

@@ -194,9 +194,9 @@ There are two possible ways to add such support:
194194

195195
What's your preference? Leave a comment below!
196196

197-
### 2. Cyclic relations
197+
### 2. Recursive relations
198198

199-
The `zenstack` CLI checks for cycles in the `check` call graph and reports an error if it finds one. This is needed to prevent infinite loops during evaluation. However, there are cases where cyclic delegation is intentionally needed. For example, if you want to model a Google Drive-like system, you may end up with a self-cycle like this:
199+
The `zenstack` CLI checks for cycles in the `check` call graph and reports an error if it finds one. This is needed to prevent infinite loops during evaluation. However, there are cases where cyclic delegation is intentionally needed, especially in the case of recursion. For example, if you want to model a Google Drive-like system, you may end up with a recursion like this:
200200

201201
```zmodel
202202
model Folder {
@@ -209,7 +209,7 @@ model Folder {
209209
}
210210
```
211211

212-
This will be a hard problem to solve since Prisma inherently doesn't support recursive queries. A possible solution is to expand the recursion with a (configurable) finite levels of depth.
212+
This will be a hard problem to solve since Prisma inherently doesn't support recursive queries (check [this issue](https://github.com/prisma/prisma/issues/3725) for details). A possible solution is to expand the recursion with a (configurable) finite levels of depth.
213213

214214
Is this something your app needs?
215215

0 commit comments

Comments
 (0)