-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0d31dfe
commit a72d925
Showing
5 changed files
with
61 additions
and
3 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
init(data: map[string]any){} | ||
|
||
/** | ||
* Validate model | ||
* @return void | ||
*/ | ||
function validate() throws: void; | ||
|
||
/** | ||
* Model transforms to map[string]any | ||
* @return map[string]any | ||
*/ | ||
function toMap(): map[string]any; | ||
|
||
/** | ||
* deep copy the Model without stream type | ||
* @return $type | ||
*/ | ||
function copyWithouStream(): $type; |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
model M { | ||
name: string, | ||
age: number, | ||
} | ||
|
||
static async function main(args: [string]): void { | ||
var m = new M{ | ||
name = 'test', | ||
age = 123 | ||
}; | ||
m.validate(); | ||
var mmap = m.toMap(); | ||
var name = $string(mmap['name']); | ||
if(name == 'test') { | ||
$Logger.info(name); | ||
} | ||
|
||
|
||
var m2: M = m.copyWithouStream(); | ||
var mmap2 = m2.toMap(); | ||
var name2 = $string(mmap2['name']); | ||
|
||
if(name2 == 'test') { | ||
$Logger.info('copyWithouStream' + name2); | ||
} | ||
} |
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