mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-02 17:22:01 +08:00

* v3 parser: add tests for model generation
* v3 parser: use single quotes for got model.ts
* v3 parser: fixes for some failing tests
* v3 parser: misc simplification and cleanup
* v3 parser: fix model tests when no structs returned
* v3 parser: fix last failing test case
* Update contributors list
* v3 parser: update README
* Revert "Update contributors list"
This reverts commit f429d2ba89
.
* Changelog: add line about my contribution
22 lines
484 B
Cheetah
22 lines
484 B
Cheetah
{{$pkg := .Package}}
|
|
export namespace {{.Package}} {
|
|
{{range $name, $def := .Models}}
|
|
export class {{$def.Name}} {
|
|
{{range $def.Fields}}{{.JSDef $pkg}}
|
|
{{end}}
|
|
static createFrom(source: any = {}) {
|
|
return new {{$def.Name}}(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) {
|
|
source = JSON.parse(source);
|
|
}
|
|
|
|
{{range $def.Fields}}this.{{.JSName}} = {{.TSBuild $pkg}};
|
|
{{end}}
|
|
}
|
|
}
|
|
{{end}}
|
|
}
|