Skip to content

Commit 0d0a3a8

Browse files
committed
fix invalid data constraint method in docs
1 parent 5ea3fec commit 0d0a3a8

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

doc/4_godelscript_language.en.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ database NewDB {
8888
// Impl
8989
impl File {
9090
@data_constraint
91-
fn all() -> *File {
91+
fn __all__() -> *File {
9292
yield File {id: 1}
9393
yield File {id: 2}
9494
}
@@ -627,7 +627,7 @@ fn out() -> bool {
627627

628628
#### Constructing Anonymous Instances
629629

630-
GödelScript allows for the creation of anonymous instances with a specific syntax. The creation of anonymous instances is contingent on the instance existing within the full set of the `schema`, unless this usage appears within a `@data_constraint` method, in which case the result will be empty.
630+
GödelScript allows for the creation of anonymous instances with a specific syntax. The creation of anonymous instances is contingent on the instance existing within the full set of the `schema`, unless this usage appears within a `__all__` method, in which case the result will be empty.
631631

632632
```rust
633633
schema A {

doc/4_godelscript_language.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ database NewDB {
8888
// impl
8989
impl File {
9090
@data_constraint
91-
fn all() -> *File {
91+
fn __all__() -> *File {
9292
yield File {id: 1}
9393
yield File {id: 2}
9494
}
@@ -607,7 +607,7 @@ impl File {
607607

608608
这种方法必须包含特殊注解`@data_constraint`,表明该方法专用于加载,如果不写该注解,则该方法的返回为**空集合**。该方法返回类型必须为其本身的集合。
609609

610-
包含了该方法的`schema`可以使用一个语法糖来获取其全集:
610+
包含该方法的`schema`可以使用一个语法糖来获取其全集:
611611

612612
```rust
613613
fn out() -> bool {
@@ -627,7 +627,7 @@ fn out() -> bool {
627627

628628
#### 构造匿名实例
629629

630-
GödelScript 允许用一个特定语法生成匿名实例。生成匿名实例的前提是该实例存在于该`schema`的全集中,除非该用法出现在`@data_constraint`方法中,否则结果为空。
630+
GödelScript 允许用一个特定语法生成匿名实例。生成匿名实例的前提是该实例存在于该`schema`的全集中,除非该用法出现在`__all__`方法中,否则结果为空。
631631

632632
```rust
633633
schema A {

0 commit comments

Comments
 (0)