5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-19 18:39:30 +08:00

Update bindings generator to generate bindings in packages and files.

Remove unused JavaScript files
Update tests.
Update v3 docs
This commit is contained in:
Lea Anthony 2023-12-22 20:01:42 +11:00
parent cdf4bdd2ba
commit 2bb25b12ff
No known key found for this signature in database
GPG Key ID: 33DAF7BB90A58405
125 changed files with 4008 additions and 2158 deletions

View File

@ -17,21 +17,16 @@ We also want to get all examples working on Linux.
#### How Can I Help? #### How Can I Help?
If you are interested in helping out, please review the table below and look for You can generate bindings using the `wails3 generate bindings` command. This will generate bindings for all exported struct methods bound to your project.
untested scenarios. The parser code and tests are located in `v3/internal/parser`. You can then use these bindings in your frontend code. You can see an example of this in the `examples/bindings` directory.
All tests can be run using `go test ./...` from the `v3` directory. Run `wails3 generate bindings -help` to view options that govern how bindings are generated.
Review the table below and look for untested scenarios. The parser code and tests are located in `v3/internal/parser`. All tests can be run using `go test ./...` from the `v3` directory.
Basically, try to break it and let us know if you find any issues! :smile: Basically, try to break it and let us know if you find any issues! :smile:
#### Status #### Status
Bindings for struct (CallByID): Bindings for struct (CallByID):
- [x] Same package
- [x] Different package
- [ ] Different package with same name
- [x] Containing another struct from same package
- [x] Containing another struct from different package
- [x] Containing an anonymous struct
- :material-check-bold: - Working - :material-check-bold: - Working
- :material-minus: - Partially working - :material-minus: - Partially working
@ -40,12 +35,6 @@ Bindings for struct (CallByID):
{{ read_csv("alpha3-bindings-callbyid.csv") }} {{ read_csv("alpha3-bindings-callbyid.csv") }}
Bindings for struct (CallByName): Bindings for struct (CallByName):
- [ ] Same package
- [ ] Different package
- [ ] Different package with same name
- [ ] Containing another struct from same package
- [ ] Containing another struct from different package
- [ ] Containing an anonymous struct
- :material-check-bold: - Working - :material-check-bold: - Working
- :material-minus: - Partially working - :material-minus: - Partially working
@ -54,32 +43,18 @@ Bindings for struct (CallByName):
{{ read_csv("alpha3-bindings-callbyname.csv") }} {{ read_csv("alpha3-bindings-callbyname.csv") }}
Models: Models:
- [x] Class model for struct in same package
- [x] Class model for struct in different package
- [ ] Interface model for struct in same package
- [ ] Interface model for struct in different package
- [x] Enum in same package
- [x] Enum in different package
- [x] Interface using enum in same package
- [ ] Interface using enum in different package
Examples:
- [ ] All examples working on Linux
- :material-check-bold: - Working - :material-check-bold: - Working
- :material-minus: - Partially working - :material-minus: - Partially working
- :material-close: - Not working - :material-close: - Not working
**Bindings**:
{{ read_csv("alpha3-bindings-callbyid.csv") }}
**Models**:
{{ read_csv("alpha3-models.csv") }} {{ read_csv("alpha3-models.csv") }}
Examples:
- [ ] All examples working on Linux
### Alpha 2 ### Alpha 2

View File

@ -1,7 +1,7 @@
Scenario,Windows,Mac,Linux,WSL Scenario,Windows,Mac,Linux,WSL
Same package," "," "," "," " Same package,:material-check-bold:," "," "," "
Different package," "," "," "," " Different package,:material-check-bold:," "," "," "
Different package with same name," "," "," "," " Different package with same name," "," "," "," "
Containing another struct from same package," "," "," "," " Containing another struct from same package,:material-check-bold:," "," "," "
Containing another struct from different package," "," "," "," " Containing another struct from different package,:material-check-bold:," "," "," "
Containing an anonymous struct," "," "," "," " Containing an anonymous struct,:material-check-bold:," "," "," "

1 Scenario Windows Mac Linux WSL
2 Same package :material-check-bold:
3 Different package :material-check-bold:
4 Different package with same name
5 Containing another struct from same package :material-check-bold:
6 Containing another struct from different package :material-check-bold:
7 Containing an anonymous struct :material-check-bold:

View File

@ -1,10 +1,10 @@
Scenario,Windows,Mac,Linux,WSL Scenario,Windows,Mac,Linux,WSL
Class model for struct in same package,:material-check-bold:," "," "," " Class model for struct in same package,:material-check-bold:," "," "," "
Class model for struct in different package,:material-check-bold:," "," "," " Class model for struct in different package,:material-check-bold:," "," "," "
Interface model for struct in same package," "," "," "," " Interface model for struct in same package,:material-check-bold:," "," "," "
Interface model for struct in different package," "," "," "," " Interface model for struct in different package,:material-check-bold:," "," "," "
Enum in same package,:material-check-bold:," "," "," " Enum in same package,:material-check-bold:," "," "," "
Enum in different package,:material-check-bold:," "," "," " Enum in different package,:material-check-bold:," "," "," "
Interface using enum in same package,:material-check-bold:," "," "," " Interface using enum in same package,:material-check-bold:," "," "," "
Interface using enum in different package," "," "," "," " Interface using enum in different package,:material-check-bold:," "," "," "

1 Scenario Windows Mac Linux WSL
2 Class model for struct in same package :material-check-bold:
3 Class model for struct in different package :material-check-bold:
4 Interface model for struct in same package :material-check-bold:
5 Interface model for struct in different package :material-check-bold:
6 Enum in same package :material-check-bold:
7 Enum in different package :material-check-bold:
8 Interface using enum in same package :material-check-bold:
9 Interface using enum in different package :material-check-bold:
10

View File

@ -7,6 +7,7 @@ toolchain go1.21.4
require ( require (
github.com/atterpac/refresh v0.2.4 github.com/atterpac/refresh v0.2.4
github.com/bep/debounce v1.2.1 github.com/bep/debounce v1.2.1
github.com/davecgh/go-spew v1.1.1
github.com/ebitengine/purego v0.4.0-alpha.4 github.com/ebitengine/purego v0.4.0-alpha.4
github.com/go-git/go-git/v5 v5.3.0 github.com/go-git/go-git/v5 v5.3.0
github.com/go-ole/go-ole v1.2.6 github.com/go-ole/go-ole v1.2.6

View File

@ -16,23 +16,26 @@ const header = `// @ts-check
` `
const bindingTemplate = ` const bindingTemplate = `
/** /**Comments
* {{structName}}.{{methodName}} * @function {{methodName}}* @param names {string}
*Comments * @returns {Promise<string>}
* @param names {string} **/
* @returns {Promise<string>}
**/
` `
const callByID = ` {{methodName}}: function({{inputs}}) { return wails.CallByID({{ID}}, ...Array.prototype.slice.call(arguments, 0)); }, const callByID = `export function {{methodName}}({{inputs}}) {
return wails.CallByID({{ID}}, ...Array.prototype.slice.call(arguments, 0));
}
` `
const callByName = ` {{methodName}}: function({{inputs}}) { return wails.CallByName("{{Name}}", ...Array.prototype.slice.call(arguments, 0)); },
const callByName = `export function {{methodName}}({{inputs}}) {
return wails.CallByName("{{Name}}", ...Array.prototype.slice.call(arguments, 0));
}
` `
const enumTemplate = ` const enumTemplate = `
export enum {{.EnumName}} { export enum {{.EnumName}} {
{{.EnumValues}} {{.EnumValues}}
} }
` `
var reservedWords = []string{ var reservedWords = []string{
@ -112,8 +115,13 @@ func sanitiseJSVarName(name string) string {
return name return name
} }
func GenerateBinding(structName string, method *BoundMethod, useIDs bool) (string, []string, []string) { type ExternalStruct struct {
var namespacedStructs []string Package string
Name string
}
func GenerateBinding(thisStructName string, method *BoundMethod, useIDs bool) (string, []string, map[packagePath]map[string]*ExternalStruct) {
var externalStructs = make(map[packagePath]map[string]*ExternalStruct)
var models []string var models []string
template := bindingTemplate template := bindingTemplate
if useIDs { if useIDs {
@ -121,7 +129,7 @@ func GenerateBinding(structName string, method *BoundMethod, useIDs bool) (strin
} else { } else {
template += callByName template += callByName
} }
result := strings.ReplaceAll(template, "{{structName}}", structName) result := strings.ReplaceAll(template, "{{structName}}", thisStructName)
result = strings.ReplaceAll(result, "{{methodName}}", method.Name) result = strings.ReplaceAll(result, "{{methodName}}", method.Name)
result = strings.ReplaceAll(result, "{{ID}}", fmt.Sprintf("%v", method.ID)) result = strings.ReplaceAll(result, "{{ID}}", fmt.Sprintf("%v", method.ID))
@ -129,10 +137,10 @@ func GenerateBinding(structName string, method *BoundMethod, useIDs bool) (strin
parts := strings.Split(method.Package, "/") parts := strings.Split(method.Package, "/")
packageName := parts[len(parts)-1] packageName := parts[len(parts)-1]
result = strings.ReplaceAll(result, "{{Name}}", fmt.Sprintf("%v.%v.%v", packageName, structName, method.Name)) result = strings.ReplaceAll(result, "{{Name}}", fmt.Sprintf("%v.%v.%v", packageName, thisStructName, method.Name))
comments := strings.TrimSpace(method.DocComment) comments := strings.TrimSpace(method.DocComment)
if comments != "" { if comments != "" {
comments = " " + comments comments = "\n * " + comments
} }
result = strings.ReplaceAll(result, "Comments", comments) result = strings.ReplaceAll(result, "Comments", comments)
var params string var params string
@ -143,16 +151,22 @@ func GenerateBinding(structName string, method *BoundMethod, useIDs bool) (strin
models = append(models, pkgName) models = append(models, pkgName)
} }
if input.Type.IsStruct || input.Type.IsEnum { if input.Type.IsStruct || input.Type.IsEnum {
nsStruct := input.NamespacedStructType() if _, ok := externalStructs[input.Type.Package]; !ok {
namespacedStructs = append(namespacedStructs, nsStruct) externalStructs[input.Type.Package] = make(map[string]*ExternalStruct)
}
externalStructs[input.Type.Package][input.Type.Name] = &ExternalStruct{
Package: input.Type.Package,
Name: input.Type.Name,
}
} }
params += " * @param " + inputName + " {" + input.JSType() + "}\n" inputType := input.JSType(packageName)
params += "\n * @param " + inputName + " {" + inputType + "}"
} }
params = strings.TrimSuffix(params, "\n") params = strings.TrimSuffix(params, "\n")
if len(params) == 0 { //if len(params) > 0 {
params = " *" // params = "\n" + params
} //}
result = strings.ReplaceAll(result, "* @param names {string}", params) result = strings.ReplaceAll(result, "* @param names {string}", params)
var inputs string var inputs string
for _, input := range method.Inputs { for _, input := range method.Inputs {
@ -181,13 +195,19 @@ func GenerateBinding(structName string, method *BoundMethod, useIDs bool) (strin
if pkgName != "" { if pkgName != "" {
models = append(models, pkgName) models = append(models, pkgName)
} }
jsType := output.JSType() jsType := output.JSType(packageName)
if jsType == "error" { if jsType == "error" {
jsType = "void" jsType = "void"
} }
if output.Type.IsStruct { if output.Type.IsStruct {
namespacedStructs = append(namespacedStructs, output.NamespacedStructType()) if _, ok := externalStructs[output.Type.Package]; !ok {
jsType = output.NamespacedStructVariable() externalStructs[output.Type.Package] = make(map[string]*ExternalStruct)
}
externalStructs[output.Type.Package][output.Type.Name] = &ExternalStruct{
Package: output.Type.Package,
Name: output.Type.Name,
}
jsType = output.NamespacedStructVariable(output.Type.Package)
} }
returns += jsType + ", " returns += jsType + ", "
} }
@ -196,7 +216,7 @@ func GenerateBinding(structName string, method *BoundMethod, useIDs bool) (strin
} }
result = strings.ReplaceAll(result, " * @returns {Promise<string>}", returns) result = strings.ReplaceAll(result, " * @returns {Promise<string>}", returns)
return result, lo.Uniq(models), lo.Uniq(namespacedStructs) return result, lo.Uniq(models), externalStructs
} }
func getPackageName(input *Parameter) string { func getPackageName(input *Parameter) string {
@ -240,47 +260,81 @@ func normalisePackageNames(packageNames []string) map[string]string {
return result return result
} }
func GenerateBindings(bindings map[string]map[string][]*BoundMethod, useIDs bool) map[string]string { func (p *Project) GenerateBindings(bindings map[string]map[string][]*BoundMethod, useIDs bool) map[string]map[string]string {
var result = make(map[string]string) var result = make(map[string]map[string]string)
var normalisedPackageNames = normalisePackageNames(lo.Keys(bindings))
// sort the bindings keys // sort the bindings keys
packageNames := lo.Keys(bindings) packageNames := lo.Keys(bindings)
sort.Strings(packageNames) sort.Strings(packageNames)
for _, packageName := range packageNames { for _, packageName := range packageNames {
var allModels []string var allModels []string
var allNamespacedStructs []string
packageBindings := bindings[packageName] packageBindings := bindings[packageName]
structNames := lo.Keys(packageBindings) structNames := lo.Keys(packageBindings)
relativePackageDir := p.RelativePackageDir(packageName)
_ = relativePackageDir
sort.Strings(structNames) sort.Strings(structNames)
for _, structName := range structNames { for _, structName := range structNames {
result[normalisedPackageNames[packageName]] += "export const " + structName + " = {\n" if _, ok := result[relativePackageDir]; !ok {
result[relativePackageDir] = make(map[string]string)
}
methods := packageBindings[structName] methods := packageBindings[structName]
sort.Slice(methods, func(i, j int) bool { sort.Slice(methods, func(i, j int) bool {
return methods[i].Name < methods[j].Name return methods[i].Name < methods[j].Name
}) })
var allNamespacedStructs map[packagePath]map[string]*ExternalStruct
var namespacedStructs map[packagePath]map[string]*ExternalStruct
var thisBinding string
var models []string
for _, method := range methods { for _, method := range methods {
thisBinding, models, namespacedStructs := GenerateBinding(structName, method, useIDs) thisBinding, models, namespacedStructs = GenerateBinding(structName, method, useIDs)
allNamespacedStructs = append(allNamespacedStructs, namespacedStructs...) // Merge the namespaced structs
allNamespacedStructs = mergeNamespacedStructs(allNamespacedStructs, namespacedStructs)
allModels = append(allModels, models...) allModels = append(allModels, models...)
result[normalisedPackageNames[packageName]] += thisBinding result[relativePackageDir][structName] += thisBinding
} }
result[normalisedPackageNames[packageName]] += "};\n\n"
}
if len(allNamespacedStructs) > 0 { if len(allNamespacedStructs) > 0 {
typedefs := "/**\n" thisPkg := p.packageCache[packageName]
for _, namespacedStruct := range lo.Uniq(allNamespacedStructs) { typedefs := "/**\n"
typedefs += " * @typedef {import('./models')." + namespacedStruct + "} " + strings.ReplaceAll(namespacedStruct, ".", "") + "\n" for externalPackageName, namespacedStruct := range allNamespacedStructs {
pkgInfo := p.packageCache[externalPackageName]
relativePackageDir := p.RelativeBindingsDir(thisPkg, pkgInfo)
namePrefix := ""
if pkgInfo.Name != "" && pkgInfo.Path != thisPkg.Path {
namePrefix = pkgInfo.Name
}
// Get keys from namespacedStruct and iterate over them in sorted order
namespacedStructNames := lo.Keys(namespacedStruct)
sort.Strings(namespacedStructNames)
for _, thisStructName := range namespacedStructNames {
structInfo := namespacedStruct[thisStructName]
typedefs += " * @typedef {import('" + relativePackageDir + "/models')." + thisStructName + "} " + namePrefix + structInfo.Name + "\n"
}
}
typedefs += " */\n"
result[relativePackageDir][structName] = typedefs + result[relativePackageDir][structName]
} }
typedefs += " */\n\n" result[relativePackageDir][structName] = header + result[relativePackageDir][structName]
result[normalisedPackageNames[packageName]] = typedefs + result[normalisedPackageNames[packageName]]
} }
result[normalisedPackageNames[packageName]] = header + result[normalisedPackageNames[packageName]]
} }
return result return result
} }
func mergeNamespacedStructs(structs map[packagePath]map[string]*ExternalStruct, structs2 map[packagePath]map[string]*ExternalStruct) map[packagePath]map[string]*ExternalStruct {
if structs == nil {
structs = make(map[packagePath]map[string]*ExternalStruct)
}
for pkg, pkgStructs := range structs2 {
if _, ok := structs[pkg]; !ok {
structs[pkg] = make(map[string]*ExternalStruct)
}
for name, structInfo := range pkgStructs {
structs[pkg][name] = structInfo
}
}
return structs
}

View File

@ -2,11 +2,11 @@ package parser
import ( import (
"embed" "embed"
"github.com/google/go-cmp/cmp"
"io/fs" "io/fs"
"os" "os"
"path/filepath"
"testing" "testing"
"github.com/google/go-cmp/cmp"
) )
//go:embed testdata //go:embed testdata
@ -25,135 +25,342 @@ func TestGenerateBindings(t *testing.T) {
tests := []struct { tests := []struct {
dir string dir string
want map[string]string want map[string]map[string]string
useIDs bool useIDs bool
}{ }{
{ {
"testdata/enum", dir: "testdata/enum",
map[string]string{ want: map[string]map[string]string{
"main": getFile("testdata/enum/bindings_main.js"), "main": {
"GreetService": getFile("testdata/enum/frontend/bindings/main/GreetService.js"),
},
}, },
true, useIDs: true,
}, },
{ {
"testdata/enum", dir: "testdata/enum",
map[string]string{ want: map[string]map[string]string{
"main": getFile("testdata/enum/bindings_main.name.js"), "main": {
"GreetService": getFile("testdata/enum/frontend/bindings/main/GreetService.name.js"),
},
}, },
false,
},
// TODO: Fix this test to pull in enum
{
"testdata/enum_from_imported_package",
map[string]string{
"main": getFile("testdata/enum_from_imported_package/bindings_main.js"),
},
true,
}, },
{ {
"testdata/function_single", dir: "testdata/enum_from_imported_package",
map[string]string{ want: map[string]map[string]string{
"main": getFile("testdata/function_single/bindings_main.js"), "main": {
"GreetService": getFile("testdata/enum_from_imported_package/frontend/bindings/main/GreetService.name.js"),
},
}, },
true,
}, },
{ {
"testdata/function_from_imported_package", dir: "testdata/enum_from_imported_package",
map[string]string{ want: map[string]map[string]string{
"main": getFile("testdata/function_from_imported_package/bindings_main.js"), "main": {
"services": getFile("testdata/function_from_imported_package/bindings_services.js"), "GreetService": getFile("testdata/enum_from_imported_package/frontend/bindings/main/GreetService.js"),
},
}, },
true, useIDs: true,
}, },
{ {
"testdata/variable_single", dir: "testdata/function_single",
map[string]string{ want: map[string]map[string]string{
"main": getFile("testdata/variable_single/bindings_main.js"), "main": {
"GreetService": getFile("testdata/function_single/frontend/bindings/main/GreetService.js"),
},
}, },
true, useIDs: true,
}, },
{ {
"testdata/variable_single_from_function", dir: "testdata/function_single",
map[string]string{ want: map[string]map[string]string{
"main": getFile("testdata/variable_single_from_function/bindings_main.js"), "main": {
"GreetService": getFile("testdata/function_single/frontend/bindings/main/GreetService.name.js"),
},
}, },
true, useIDs: false,
}, },
{ {
"testdata/variable_single_from_other_function", dir: "testdata/function_from_imported_package",
map[string]string{ want: map[string]map[string]string{
"main": getFile("testdata/variable_single_from_other_function/bindings_main.js"), "main": {
"services": getFile("testdata/variable_single_from_other_function/bindings_services.js"), "GreetService": getFile("testdata/function_from_imported_package/frontend/bindings/main/GreetService.name.js"),
},
"services": {
"OtherService": getFile("testdata/function_from_imported_package/frontend/bindings/services/OtherService.name.js"),
},
}, },
true, useIDs: false,
}, },
{ {
"testdata/struct_literal_single", dir: "testdata/function_from_imported_package",
map[string]string{ want: map[string]map[string]string{
"main": getFile("testdata/struct_literal_single/bindings_main.js"), "main": {
"GreetService": getFile("testdata/function_from_imported_package/frontend/bindings/main/GreetService.js"),
},
"services": {
"OtherService": getFile("testdata/function_from_imported_package/frontend/bindings/services/OtherService.js"),
},
}, },
true, useIDs: true,
}, },
{ {
"testdata/struct_literal_multiple", dir: "testdata/function_from_nested_imported_package",
map[string]string{ want: map[string]map[string]string{
"main": getFile("testdata/struct_literal_multiple/bindings_main.js"), "main": {
"GreetService": getFile("testdata/function_from_nested_imported_package/frontend/bindings/main/GreetService.name.js"),
},
"services/other": {
"OtherService": getFile("testdata/function_from_nested_imported_package/frontend/bindings/services/other/OtherService.name.js"),
},
}, },
true, useIDs: false,
}, },
{ {
"testdata/struct_literal_multiple_other", dir: "testdata/function_from_nested_imported_package",
map[string]string{ want: map[string]map[string]string{
"main": getFile("testdata/struct_literal_multiple_other/bindings_main.js"), "main": {
"services": getFile("testdata/struct_literal_multiple_other/bindings_services.js"), "GreetService": getFile("testdata/function_from_nested_imported_package/frontend/bindings/main/GreetService.js"),
},
"services/other": {
"OtherService": getFile("testdata/function_from_nested_imported_package/frontend/bindings/services/other/OtherService.js"),
},
}, },
true, useIDs: true,
}, },
{ {
"testdata/struct_literal_multiple_files", dir: "testdata/struct_literal_multiple",
map[string]string{ want: map[string]map[string]string{
"main": getFile("testdata/struct_literal_multiple_files/bindings_main.js"), "main": {
"GreetService": getFile("testdata/struct_literal_multiple/frontend/bindings/main/GreetService.js"),
"OtherService": getFile("testdata/struct_literal_multiple/frontend/bindings/main/OtherService.js"),
},
}, },
true, useIDs: true,
},
{
dir: "testdata/struct_literal_multiple",
want: map[string]map[string]string{
"main": {
"GreetService": getFile("testdata/struct_literal_multiple/frontend/bindings/main/GreetService.name.js"),
"OtherService": getFile("testdata/struct_literal_multiple/frontend/bindings/main/OtherService.name.js"),
},
},
useIDs: false,
},
{
dir: "testdata/function_from_imported_package",
want: map[string]map[string]string{
"main": {
"GreetService": getFile("testdata/function_from_imported_package/frontend/bindings/main/GreetService.js"),
},
"services": {
"OtherService": getFile("testdata/function_from_imported_package/frontend/bindings/services/OtherService.js"),
},
},
useIDs: true,
},
{
dir: "testdata/function_from_imported_package",
want: map[string]map[string]string{
"main": {
"GreetService": getFile("testdata/function_from_imported_package/frontend/bindings/main/GreetService.name.js"),
},
"services": {
"OtherService": getFile("testdata/function_from_imported_package/frontend/bindings/services/OtherService.name.js"),
},
},
useIDs: false,
},
{
dir: "testdata/variable_single",
want: map[string]map[string]string{
"main": {
"GreetService": getFile("testdata/variable_single/frontend/bindings/main/GreetService.name.js"),
},
},
useIDs: false,
},
{
dir: "testdata/variable_single",
want: map[string]map[string]string{
"main": {
"GreetService": getFile("testdata/variable_single/frontend/bindings/main/GreetService.js"),
},
},
useIDs: true,
},
{
dir: "testdata/variable_single_from_function",
want: map[string]map[string]string{
"main": {
"GreetService": getFile("testdata/variable_single_from_function/frontend/bindings/main/GreetService.name.js"),
},
},
useIDs: false,
},
{
dir: "testdata/variable_single_from_function",
want: map[string]map[string]string{
"main": {
"GreetService": getFile("testdata/variable_single_from_function/frontend/bindings/main/GreetService.js"),
},
},
useIDs: true,
},
{
dir: "testdata/variable_single_from_other_function",
want: map[string]map[string]string{
"main": {
"GreetService": getFile("testdata/variable_single_from_other_function/frontend/bindings/main/GreetService.name.js"),
},
"services": {
"OtherService": getFile("testdata/variable_single_from_other_function/frontend/bindings/services/OtherService.name.js"),
},
},
useIDs: false,
},
{
dir: "testdata/variable_single_from_other_function",
want: map[string]map[string]string{
"main": {
"GreetService": getFile("testdata/variable_single_from_other_function/frontend/bindings/main/GreetService.js"),
},
"services": {
"OtherService": getFile("testdata/variable_single_from_other_function/frontend/bindings/services/OtherService.js"),
},
},
useIDs: true,
},
{
dir: "testdata/struct_literal_single",
want: map[string]map[string]string{
"main": {
"GreetService": getFile("testdata/struct_literal_single/frontend/bindings/main/GreetService.name.js"),
},
},
useIDs: false,
},
{
dir: "testdata/struct_literal_single",
want: map[string]map[string]string{
"main": {
"GreetService": getFile("testdata/struct_literal_single/frontend/bindings/main/GreetService.js"),
},
},
useIDs: true,
},
{
dir: "testdata/struct_literal_multiple_other",
want: map[string]map[string]string{
"main": {
"GreetService": getFile("testdata/struct_literal_multiple_other/frontend/bindings/main/GreetService.name.js"),
},
"services": {
"OtherService": getFile("testdata/struct_literal_multiple_other/frontend/bindings/services/OtherService.name.js"),
},
},
useIDs: false,
},
{
dir: "testdata/struct_literal_multiple_other",
want: map[string]map[string]string{
"main": {
"GreetService": getFile("testdata/struct_literal_multiple_other/frontend/bindings/main/GreetService.js"),
},
"services": {
"OtherService": getFile("testdata/struct_literal_multiple_other/frontend/bindings/services/OtherService.js"),
},
},
useIDs: true,
},
{
dir: "testdata/struct_literal_non_pointer_single",
want: map[string]map[string]string{
"main": {
"GreetService": getFile("testdata/struct_literal_non_pointer_single/frontend/bindings/main/GreetService.name.js"),
},
},
useIDs: false,
},
{
dir: "testdata/struct_literal_non_pointer_single",
want: map[string]map[string]string{
"main": {
"GreetService": getFile("testdata/struct_literal_non_pointer_single/frontend/bindings/main/GreetService.js"),
},
},
useIDs: true,
},
{
dir: "testdata/struct_literal_multiple_files",
want: map[string]map[string]string{
"main": {
"GreetService": getFile("testdata/struct_literal_multiple_files/frontend/bindings/main/GreetService.name.js"),
"OtherService": getFile("testdata/struct_literal_multiple_files/frontend/bindings/main/OtherService.name.js"),
},
},
useIDs: false,
},
{
dir: "testdata/struct_literal_multiple_files",
want: map[string]map[string]string{
"main": {
"GreetService": getFile("testdata/struct_literal_multiple_files/frontend/bindings/main/GreetService.js"),
"OtherService": getFile("testdata/struct_literal_multiple_files/frontend/bindings/main/OtherService.js"),
},
},
useIDs: true,
}, },
} }
for _, tt := range tests { for _, tt := range tests {
t.Run(tt.dir, func(t *testing.T) { t.Run(tt.dir, func(t *testing.T) {
// Run parser on directory // Run parser on directory
project, err := ParseProject(tt.dir) absDir, err := filepath.Abs(tt.dir)
if err != nil {
t.Errorf("filepath.Abs() error = %v", err)
return
}
project, err := ParseProject(absDir)
if err != nil { if err != nil {
t.Errorf("ParseProject() error = %v", err) t.Errorf("ParseProject() error = %v", err)
return return
} }
project.outputDirectory = "frontend/bindings"
// Generate Bindings // Generate Bindings
got := GenerateBindings(project.BoundMethods, tt.useIDs) got := project.GenerateBindings(project.BoundMethods, tt.useIDs)
for name, binding := range got { for dirName, structDetails := range got {
// check if the binding is in the expected bindings // iterate the struct names in structDetails
expected, ok := tt.want[name] for name, binding := range structDetails {
if !ok { expected, ok := tt.want[dirName][name]
err = os.WriteFile(tt.dir+"/bindings_"+name+".got.js", []byte(binding), 0644) if !ok {
if err != nil { outFile := filepath.Join(tt.dir, project.outputDirectory, dirName, name+".got.js")
t.Errorf("os.WriteFile() error = %v", err) err = os.WriteFile(outFile, []byte(binding), 0644)
if err != nil {
t.Errorf("os.WriteFile() error = %v", err)
return
}
t.Errorf("GenerateBindings() unexpected binding = %v", name)
return return
} }
t.Errorf("GenerateBindings() unexpected binding = %v", name) // compare the binding
return
}
// compare the binding
// convert all line endings to \n // convert all line endings to \n
binding = convertLineEndings(binding) binding = convertLineEndings(binding)
expected = convertLineEndings(expected) expected = convertLineEndings(expected)
if diff := cmp.Diff(expected, binding); diff != "" { if diff := cmp.Diff(expected, binding); diff != "" {
err = os.WriteFile(tt.dir+"/bindings_"+name+".got.js", []byte(binding), 0644) outFile := filepath.Join(tt.dir, project.outputDirectory, dirName, name+".got.js")
if err != nil { err = os.WriteFile(outFile, []byte(binding), 0644)
t.Errorf("os.WriteFile() error = %v", err) if err != nil {
return t.Errorf("os.WriteFile() error = %v", err)
return
}
t.Fatalf("GenerateBindings() mismatch (-want +got):\n%s", diff)
} }
t.Fatalf("GenerateBindings() mismatch (-want +got):\n%s", diff)
} }
} }
}) })

View File

@ -17,9 +17,10 @@ type ModelDefinitions struct {
Package string Package string
Models map[string]*StructDef Models map[string]*StructDef
Enums map[string]*TypeDef Enums map[string]*TypeDef
Imports []*ImportDef
} }
func GenerateModel(wr io.Writer, def *ModelDefinitions, options *flags.GenerateBindingsOptions) error { func (p *Project) GenerateModel(wr io.Writer, def *ModelDefinitions, options *flags.GenerateBindingsOptions) error {
templateName := "model.js.tmpl" templateName := "model.js.tmpl"
if options.TS { if options.TS {
templateName = "model.ts.tmpl" templateName = "model.ts.tmpl"
@ -57,13 +58,15 @@ func pkgAlias(fullPkg string) string {
return pkgParts[len(pkgParts)-1] return pkgParts[len(pkgParts)-1]
} }
func GenerateModels(models map[packagePath]map[structName]*StructDef, enums map[packagePath]map[string]*TypeDef, options *flags.GenerateBindingsOptions) (string, error) { type Model struct {
if models == nil && enums == nil { Package string
return "", nil }
}
var buffer bytes.Buffer func (p *Project) GenerateModels(models map[packagePath]map[structName]*StructDef, enums map[packagePath]map[string]*TypeDef, options *flags.GenerateBindingsOptions) (map[packagePath]string, error) {
buffer.WriteString(modelsHeader) if models == nil && enums == nil {
return nil, nil
}
var result = make(map[packagePath]string)
// sort pkgs by alias (e.g. services) instead of full pkg name (e.g. github.com/wailsapp/wails/somedir/services) // sort pkgs by alias (e.g. services) instead of full pkg name (e.g. github.com/wailsapp/wails/somedir/services)
// and then sort resulting list by the alias // and then sort resulting list by the alias
@ -80,14 +83,21 @@ func GenerateModels(models map[packagePath]map[structName]*StructDef, enums map[
}) })
for _, pkg := range keys { for _, pkg := range keys {
err := GenerateModel(&buffer, &ModelDefinitions{ var buffer bytes.Buffer
buffer.WriteString(modelsHeader)
err := p.GenerateModel(&buffer, &ModelDefinitions{
Imports: p.calculateImports(pkg, models[pkg]),
Package: pkgAlias(pkg), Package: pkgAlias(pkg),
Models: models[pkg], Models: models[pkg],
Enums: enums[pkg], Enums: enums[pkg],
}, options) }, options)
if err != nil { if err != nil {
return "", err return nil, err
} }
// Get the relative package path
relativePackageDir := p.RelativePackageDir(pkg)
result[relativePackageDir] = buffer.String()
} }
return buffer.String(), nil return result, nil
} }

View File

@ -14,109 +14,199 @@ func TestGenerateModels(t *testing.T) {
tests := []struct { tests := []struct {
name string name string
dir string dir string
want string want map[string]string
useInterface bool useInterface bool
useTypescript bool useTypescript bool
}{ }{
// enum
{ {
name: "function single", name: "enum - Typescript",
dir: "testdata/function_single",
useTypescript: true,
},
{
name: "function from imported package",
dir: "testdata/function_from_imported_package",
want: getFile("testdata/function_from_imported_package/models.ts"),
useTypescript: true,
},
{
name: "function from imported package (Javascript)",
dir: "testdata/function_from_imported_package",
want: getFile("testdata/function_from_imported_package/models.js"),
},
{
name: "variable single",
dir: "testdata/variable_single",
useTypescript: true,
},
{
name: "variable single from function",
dir: "testdata/variable_single_from_function",
useTypescript: true,
},
{
name: "variable single from other function",
dir: "testdata/variable_single_from_other_function",
want: getFile("testdata/variable_single_from_other_function/models.ts"),
useTypescript: true,
},
{
name: "struct literal single",
dir: "testdata/struct_literal_single",
want: getFile("testdata/struct_literal_single/models.ts"),
useTypescript: true,
},
{
name: "struct literal multiple",
dir: "testdata/struct_literal_multiple",
useTypescript: true,
},
{
name: "struct literal multiple other",
dir: "testdata/struct_literal_multiple_other",
want: getFile("testdata/struct_literal_multiple_other/models.ts"),
useTypescript: true,
},
{
name: "struct literal multiple other (Javascript)",
dir: "testdata/struct_literal_multiple_other",
want: getFile("testdata/struct_literal_multiple_other/models.js"),
},
{
name: "struct literal non pointer single (Javascript)",
dir: "testdata/struct_literal_non_pointer_single",
want: getFile("testdata/struct_literal_non_pointer_single/models.ts"),
useTypescript: true,
},
{
name: "struct literal non pointer single (Javascript)",
dir: "testdata/struct_literal_non_pointer_single",
want: getFile("testdata/struct_literal_non_pointer_single/models.js"),
},
{
name: "struct literal multiple files",
dir: "testdata/struct_literal_multiple_files",
useTypescript: true,
},
{
name: "enum",
dir: "testdata/enum",
want: getFile("testdata/enum/models.ts"),
useTypescript: true,
},
{
name: "enum (Javascript)",
dir: "testdata/enum", dir: "testdata/enum",
want: getFile("testdata/enum/models.js"), want: map[string]string{
}, "main": getFile("testdata/enum/frontend/bindings/main/models.ts"),
{ },
name: "enum from imported package",
dir: "testdata/enum_from_imported_package",
want: getFile("testdata/enum_from_imported_package/models.ts"),
useTypescript: true, useTypescript: true,
}, },
{ {
name: "enum from imported package", name: "enum - Javascript",
dir: "testdata/enum_from_imported_package", dir: "testdata/enum",
want: getFile("testdata/enum_from_imported_package/models.js"), want: map[string]string{
"main": getFile("testdata/enum/frontend/bindings/main/models.js"),
},
useTypescript: false, useTypescript: false,
}, },
{ {
name: "enum interface", name: "enum - Typescript interfaces",
dir: "testdata/enum-interface", dir: "testdata/enum",
want: getFile("testdata/enum-interface/models.ts"), want: map[string]string{
useInterface: true, "main": getFile("testdata/enum/frontend/bindings/main/models.interfaces.ts"),
},
useTypescript: true, useTypescript: true,
useInterface: true,
},
// function from imported package
{
name: "function from imported package - Typescript",
dir: "testdata/function_from_imported_package",
want: map[string]string{
"main": getFile("testdata/function_from_imported_package/frontend/bindings/main/models.ts"),
"services": getFile("testdata/function_from_imported_package/frontend/bindings/services/models.ts"),
},
useTypescript: true,
},
{
name: "function from imported package - Typescript interfaces",
dir: "testdata/function_from_imported_package",
want: map[string]string{
"main": getFile("testdata/function_from_imported_package/frontend/bindings/main/models.interfaces.ts"),
"services": getFile("testdata/function_from_imported_package/frontend/bindings/services/models.interfaces.ts"),
},
useTypescript: true,
useInterface: true,
},
{
name: "function from imported package - Javascript",
dir: "testdata/function_from_imported_package",
want: map[string]string{
"main": getFile("testdata/function_from_imported_package/frontend/bindings/main/models.js"),
"services": getFile("testdata/function_from_imported_package/frontend/bindings/services/models.js"),
},
useTypescript: false,
},
// variable single from other function
{
name: "variable single from other function - Typescript",
dir: "testdata/variable_single_from_other_function",
want: map[string]string{
"main": getFile("testdata/variable_single_from_other_function/frontend/bindings/main/models.ts"),
"services": getFile("testdata/variable_single_from_other_function/frontend/bindings/services/models.ts"),
},
useTypescript: true,
},
{
name: "variable single from other function - Typescript interfaces",
dir: "testdata/variable_single_from_other_function",
want: map[string]string{
"main": getFile("testdata/variable_single_from_other_function/frontend/bindings/main/models.interfaces.ts"),
"services": getFile("testdata/variable_single_from_other_function/frontend/bindings/services/models.interfaces.ts"),
},
useTypescript: true,
useInterface: true,
},
{
name: "variable single from other function - Javascript",
dir: "testdata/variable_single_from_other_function",
want: map[string]string{
"main": getFile("testdata/variable_single_from_other_function/frontend/bindings/main/models.js"),
"services": getFile("testdata/variable_single_from_other_function/frontend/bindings/services/models.js"),
},
useTypescript: false,
},
// struct literal single
{
name: "struct literal single - Typescript",
dir: "testdata/struct_literal_single",
want: map[string]string{
"main": getFile("testdata/struct_literal_single/frontend/bindings/main/models.ts"),
},
useTypescript: true,
},
{
name: "struct literal single - Typescript interfaces",
dir: "testdata/struct_literal_single",
want: map[string]string{
"main": getFile("testdata/struct_literal_single/frontend/bindings/main/models.interfaces.ts"),
},
useTypescript: true,
useInterface: true,
},
{
name: "struct literal single - Javascript",
dir: "testdata/struct_literal_single",
want: map[string]string{
"main": getFile("testdata/struct_literal_single/frontend/bindings/main/models.js"),
},
useTypescript: false,
},
// struct literal multiple other
{
name: "struct literal multiple other - Typescript",
dir: "testdata/struct_literal_multiple_other",
want: map[string]string{
"main": getFile("testdata/struct_literal_multiple_other/frontend/bindings/main/models.ts"),
"services": getFile("testdata/struct_literal_multiple_other/frontend/bindings/services/models.ts"),
},
useTypescript: true,
},
{
name: "struct literal multiple other - Typescript interfaces",
dir: "testdata/struct_literal_multiple_other",
want: map[string]string{
"main": getFile("testdata/struct_literal_multiple_other/frontend/bindings/main/models.interfaces.ts"),
"services": getFile("testdata/struct_literal_multiple_other/frontend/bindings/services/models.interfaces.ts"),
},
useTypescript: true,
useInterface: true,
},
{
name: "struct literal multiple other - Javascript",
dir: "testdata/struct_literal_multiple_other",
want: map[string]string{
"main": getFile("testdata/struct_literal_multiple_other/frontend/bindings/main/models.js"),
"services": getFile("testdata/struct_literal_multiple_other/frontend/bindings/services/models.js"),
},
useTypescript: false,
},
// struct literal non pointer single
{
name: "struct literal non pointer single - Typescript",
dir: "testdata/struct_literal_non_pointer_single",
want: map[string]string{
"main": getFile("testdata/struct_literal_non_pointer_single/frontend/bindings/main/models.ts"),
},
useTypescript: true,
},
{
name: "struct literal non pointer single - Typescript interfaces",
dir: "testdata/struct_literal_non_pointer_single",
want: map[string]string{
"main": getFile("testdata/struct_literal_non_pointer_single/frontend/bindings/main/models.interfaces.ts"),
},
useTypescript: true,
useInterface: true,
},
{
name: "struct literal non pointer single - Javascript",
dir: "testdata/struct_literal_non_pointer_single",
want: map[string]string{
"main": getFile("testdata/struct_literal_non_pointer_single/frontend/bindings/main/models.js"),
},
useTypescript: false,
},
// enum from imported package
{
name: "enum from imported package - Typescript",
dir: "testdata/enum_from_imported_package",
want: map[string]string{
"services": getFile("testdata/enum_from_imported_package/frontend/bindings/services/models.ts"),
},
useTypescript: true,
},
{
name: "enum from imported package - Typescript interfaces",
dir: "testdata/enum_from_imported_package",
want: map[string]string{
"services": getFile("testdata/enum_from_imported_package/frontend/bindings/services/models.interfaces.ts"),
},
useTypescript: true,
},
{
name: "enum from imported package - Javascript",
dir: "testdata/enum_from_imported_package",
want: map[string]string{
"services": getFile("testdata/enum_from_imported_package/frontend/bindings/services/models.js"),
},
useTypescript: false,
}, },
} }
for _, tt := range tests { for _, tt := range tests {
@ -127,28 +217,39 @@ func TestGenerateModels(t *testing.T) {
t.Fatalf("ParseProject() error = %v", err) t.Fatalf("ParseProject() error = %v", err)
} }
project.outputDirectory = "frontend/bindings"
// Generate Models // Generate Models
got, err := GenerateModels(project.Models, project.Types, &flags.GenerateBindingsOptions{ allModels, err := project.GenerateModels(project.Models, project.Types, &flags.GenerateBindingsOptions{
UseInterfaces: tt.useInterface, UseInterfaces: tt.useInterface,
TS: tt.useTypescript, TS: tt.useTypescript,
}) })
if err != nil { if err != nil {
t.Fatalf("GenerateModels() error = %v", err) t.Fatalf("GenerateModels() error = %v", err)
} }
// convert all line endings to \n for pkgDir, got := range allModels {
got = convertLineEndings(got) // convert all line endings to \n
want := convertLineEndings(tt.want) got = convertLineEndings(got)
if diff := cmp.Diff(want, got); diff != "" { want, ok := tt.want[pkgDir]
gotFilename := "models.got.js" if !ok {
if tt.useTypescript { t.Fatalf("GenerateModels() missing package: %s", pkgDir)
gotFilename = "models.got.ts"
} }
err = os.WriteFile(filepath.Join(tt.dir, gotFilename), []byte(got), 0644) want = convertLineEndings(want)
if err != nil { if diff := cmp.Diff(want, got); diff != "" {
t.Errorf("os.WriteFile() error = %v", err) gotFilename := "models.got.js"
return if tt.useTypescript {
gotFilename = "models.got.ts"
}
// Get relative package path
//relativeBindingsDir := project.RelativeBindingsDir(project.packageCache[pkgDir])
err = os.WriteFile(filepath.Join(tt.dir, project.outputDirectory, pkgDir, gotFilename), []byte(got), 0644)
if err != nil {
t.Errorf("os.WriteFile() error = %v", err)
return
}
t.Fatalf("GenerateModels() mismatch (-want +got):\n%s", diff)
} }
t.Fatalf("GenerateModels() mismatch (-want +got):\n%s", diff)
} }
}) })
} }

View File

@ -23,9 +23,9 @@ type packagePath = string
type structName = string type structName = string
type StructDef struct { type StructDef struct {
Name string Name string
DocComment string DocComments []string
Fields []*Field Fields []*Field
} }
func (s *StructDef) DefaultValueList() string { func (s *StructDef) DefaultValueList() string {
@ -66,24 +66,24 @@ type Parameter struct {
Type *ParameterType Type *ParameterType
} }
func (p *Parameter) NamespacedStructType() string { func (p *Parameter) NamespacedStructType(pkgName string) string {
var typeName string var typeName string
if p.Type.Package != "" { if p.Type.Package != "" && p.Type.Package != pkgName {
parts := strings.Split(p.Type.Package, "/") parts := strings.Split(p.Type.Package, "/")
typeName = parts[len(parts)-1] + "." typeName = parts[len(parts)-1] + "."
} }
return typeName + p.Type.Name return typeName + p.Type.Name
} }
func (p *Parameter) NamespacedStructVariable() string { func (p *Parameter) NamespacedStructVariable(pkgName string) string {
var typeName string var typeName string
if p.Type.Package != "" { if p.Type.Package != "" && p.Type.Package != pkgName {
parts := strings.Split(p.Type.Package, "/") parts := strings.Split(p.Type.Package, "/")
typeName = parts[len(parts)-1] typeName = parts[len(parts)-1]
} }
return typeName + p.Type.Name return typeName + p.Type.Name
} }
func (p *Parameter) JSType() string { func (p *Parameter) JSType(pkgName string) string {
// Convert type to javascript equivalent type // Convert type to javascript equivalent type
var typeName string var typeName string
switch p.Type.Name { switch p.Type.Name {
@ -99,7 +99,7 @@ func (p *Parameter) JSType() string {
// if the type is a struct, we need to add the package name // if the type is a struct, we need to add the package name
if p.Type.IsStruct || p.Type.IsEnum { if p.Type.IsStruct || p.Type.IsEnum {
typeName = p.NamespacedStructType() typeName = p.NamespacedStructType(pkgName)
typeName = strings.ReplaceAll(typeName, ".", "") typeName = strings.ReplaceAll(typeName, ".", "")
} }
@ -118,6 +118,7 @@ func (p *Parameter) JSType() string {
type BoundMethod struct { type BoundMethod struct {
Package string Package string
PackageDir string
Name string Name string
DocComment string DocComment string
Inputs []*Parameter Inputs []*Parameter
@ -131,8 +132,9 @@ func (m BoundMethod) IDAsString() string {
} }
type Field struct { type Field struct {
Name string Name string
Type *ParameterType Type *ParameterType
Project *Project
} }
func (f *Field) JSName() string { func (f *Field) JSName() string {
@ -195,17 +197,24 @@ func (f *Field) JSDocType(pkg string) string {
jsType = f.Type.Name jsType = f.Type.Name
} }
// If we are the same package, just return the type
externalPkgInfo := f.Project.packageCache[f.Type.Package]
if externalPkgInfo.Name == pkg {
return jsType
}
var result string var result string
isExternalStruct := f.Type.Package != "" && f.Type.Package != pkg && f.Type.IsStruct isExternalStruct := f.Type.Package != "" && f.Type.Package != pkg && f.Type.IsStruct
if f.Type.Package == "" || f.Type.Package == pkg || !isExternalStruct { if f.Type.Package == "" || !isExternalStruct {
if f.Type.IsStruct || f.Type.IsEnum { if f.Type.IsStruct || f.Type.IsEnum {
result = fmt.Sprintf("%s.%s", pkg, jsType) // get the relative package directory
result = fmt.Sprintf("%s%s", externalPkgInfo.Name, f.Type.Name)
} else { } else {
result = jsType result = jsType
} }
} else { } else {
parts := strings.Split(f.Type.Package, "/") // get the relative package directory
result += fmt.Sprintf("%s.%s", parts[len(parts)-1], jsType) result = fmt.Sprintf("%s%s", externalPkgInfo.Name, f.Type.Name)
} }
if !ast.IsExported(f.Name) { if !ast.IsExported(f.Name) {
@ -230,9 +239,9 @@ func (f *Field) DefaultValue() string {
} }
type ConstDef struct { type ConstDef struct {
Name string Name string
DocComment string DocComments []string
Value string Value string
} }
type TypeDef struct { type TypeDef struct {
@ -258,6 +267,7 @@ type ParsedPackage struct {
type Project struct { type Project struct {
packageCache map[string]*ParsedPackage packageCache map[string]*ParsedPackage
outputDirectory string
Path string Path string
BoundMethods map[packagePath]map[structName][]*BoundMethod BoundMethods map[packagePath]map[structName][]*BoundMethod
Models map[packagePath]map[structName]*StructDef Models map[packagePath]map[structName]*StructDef
@ -320,13 +330,21 @@ func GenerateBindingsAndModels(options *flags.GenerateBindingsOptions) error {
return err return err
} }
p.Stats.NumMethods = len(p.BoundMethods) p.Stats.NumMethods = len(p.BoundMethods)
generatedMethods := GenerateBindings(p.BoundMethods, options.UseIDs) p.outputDirectory = options.OutputDirectory
for pkg, text := range generatedMethods { generatedMethods := p.GenerateBindings(p.BoundMethods, options.UseIDs)
// Write the file for pkg, structs := range generatedMethods {
err = os.WriteFile(filepath.Join(options.OutputDirectory, pkg+".js"), []byte(text), 0644) // Write the directory
if err != nil { err = os.MkdirAll(filepath.Join(options.OutputDirectory, pkg), 0755)
if err != nil && !os.IsExist(err) {
return err return err
} }
// Write the files
for structName, text := range structs {
err = os.WriteFile(filepath.Join(options.OutputDirectory, pkg, structName+".js"), []byte(text), 0644)
if err != nil {
return err
}
}
} }
p.Stats.NumModels = len(p.Models) p.Stats.NumModels = len(p.Models)
@ -334,11 +352,17 @@ func GenerateBindingsAndModels(options *flags.GenerateBindingsOptions) error {
// Generate Models // Generate Models
if len(p.Models) > 0 { if len(p.Models) > 0 {
generatedModels, err := GenerateModels(p.Models, p.Types, options) generatedModels, err := p.GenerateModels(p.Models, p.Types, options)
if err != nil { if err != nil {
return err return err
} }
err = os.WriteFile(filepath.Join(options.OutputDirectory, options.ModelsFilename), []byte(generatedModels), 0644) for pkg, text := range generatedModels {
// Get directory for package
pkgInfo := p.packageCache[pkg]
relativePackageDir := p.RelativeBindingsDir(pkgInfo, pkgInfo)
// Write the directory
err = os.WriteFile(filepath.Join(options.OutputDirectory, relativePackageDir, options.ModelsFilename), []byte(text), 0644)
}
if err != nil { if err != nil {
return err return err
} }
@ -602,6 +626,7 @@ func (p *Project) parseBoundStructMethods(name string, pkg *ParsedPackage) error
method := &BoundMethod{ method := &BoundMethod{
Package: pkg.Path, Package: pkg.Path,
PackageDir: pkg.Dir,
ID: id, ID: id,
Name: funcDecl.Name.Name, Name: funcDecl.Name.Name,
DocComment: strings.TrimSpace(funcDecl.Doc.Text()), DocComment: strings.TrimSpace(funcDecl.Doc.Text()),
@ -689,7 +714,8 @@ func (p *Project) parseParameterType(field *ast.Field, pkg *ParsedPackage) *Para
result.Name = p.anonymousStructID() result.Name = p.anonymousStructID()
// Create a new struct definition // Create a new struct definition
result := &StructDef{ result := &StructDef{
Name: result.Name, Name: result.Name,
DocComments: CommentGroupToText(field.Doc),
} }
pkg.StructCache[result.Name] = result pkg.StructCache[result.Name] = result
// Parse the fields // Parse the fields
@ -750,8 +776,8 @@ func (p *Project) getStructDef(name string, pkg *ParsedPackage) bool {
if structType, ok := typeSpec.Type.(*ast.StructType); ok { if structType, ok := typeSpec.Type.(*ast.StructType); ok {
if typeSpec.Name.Name == name { if typeSpec.Name.Name == name {
result := &StructDef{ result := &StructDef{
Name: name, Name: name,
//TODO DocComment: CommentGroupToText(typeDecl.Doc), DocComments: CommentGroupToText(typeDecl.Doc),
} }
pkg.StructCache[name] = result pkg.StructCache[name] = result
result.Fields = p.parseStructFields(structType, pkg) result.Fields = p.parseStructFields(structType, pkg)
@ -774,12 +800,14 @@ func (p *Project) parseStructFields(structType *ast.StructType, pkg *ParsedPacka
if len(field.Names) > 0 { if len(field.Names) > 0 {
for _, name := range field.Names { for _, name := range field.Names {
theseFields = append(theseFields, &Field{ theseFields = append(theseFields, &Field{
Name: name.Name, Project: p,
Name: name.Name,
}) })
} }
} else { } else {
theseFields = append(theseFields, &Field{ theseFields = append(theseFields, &Field{
Name: "", Project: p,
Name: "",
}) })
} }
// loop over fields // loop over fields
@ -1079,7 +1107,7 @@ func (p *Project) parseConstDeclaration(decl *ast.GenDecl, pkg *ParsedPackage) {
} }
if valueSpec.Doc != nil { if valueSpec.Doc != nil {
constDecl.DocComment = strings.TrimSpace(valueSpec.Doc.Text()) constDecl.DocComments = CommentGroupToText(valueSpec.Doc)
} }
typeDecl.Consts = append(typeDecl.Consts, constDecl) typeDecl.Consts = append(typeDecl.Consts, constDecl)
} }
@ -1087,7 +1115,22 @@ func (p *Project) parseConstDeclaration(decl *ast.GenDecl, pkg *ParsedPackage) {
} }
func (p *Project) RelativePackageDir(path string) string { func (p *Project) RelativePackageDir(path string) string {
return strings.TrimPrefix(path, p.Path)
// Get the package details
pkgInfo, ok := p.packageCache[path]
if !ok {
panic("package not found: " + path)
}
result := filepath.ToSlash(strings.TrimPrefix(pkgInfo.Dir, p.Path))
if result == "" {
return "main"
}
// Remove the leading slash
if result[0] == '/' || result[0] == '\\' {
result = result[1:]
}
return result
} }
func (p *Project) parseTypes(pkgs map[string]*ParsedPackage) { func (p *Project) parseTypes(pkgs map[string]*ParsedPackage) {
@ -1126,6 +1169,56 @@ func (p *Project) parseTypes(pkgs map[string]*ParsedPackage) {
} }
} }
func (p *Project) RelativeBindingsDir(dir *ParsedPackage, dir2 *ParsedPackage) string {
if dir.Dir == dir2.Dir {
return "."
}
// Calculate the relative path from the bindings directory to the package directory
absoluteSourceDir := dir.Dir
if absoluteSourceDir == p.Path {
absoluteSourceDir = filepath.Join(p.Path, p.outputDirectory, "main")
} else {
absoluteSourceDir = dir.Dir
}
targetRelativeDir := strings.TrimPrefix(dir2.Dir, p.Path)
targetBindingsDir := filepath.Join(p.Path, p.outputDirectory, targetRelativeDir)
// Calculate the relative path from the source directory to the target directory
relativePath, err := filepath.Rel(absoluteSourceDir, targetBindingsDir)
if err != nil {
panic(err)
}
return filepath.ToSlash(relativePath)
}
type ImportDef struct {
Name string
Path string
VarName string
PackageName string
}
func (p *Project) calculateImports(pkg string, m map[structName]*StructDef) []*ImportDef {
var result []*ImportDef
for _, structDef := range m {
for _, field := range structDef.Fields {
if field.Type.Package != pkg {
// Find the relative path from the source directory to the target directory
fieldPkgInfo := p.packageCache[field.Type.Package]
relativePath := p.RelativeBindingsDir(p.packageCache[pkg], fieldPkgInfo)
result = append(result, &ImportDef{
PackageName: fieldPkgInfo.Name,
Name: field.Name,
Path: relativePath,
VarName: fieldPkgInfo.Name + field.Name,
})
}
}
}
return result
}
func getTypeString(expr ast.Expr) string { func getTypeString(expr ast.Expr) string {
switch t := expr.(type) { switch t := expr.(type) {
case *ast.Ident: case *ast.Ident:

View File

@ -87,13 +87,14 @@ func TestParseEnum(t *testing.T) {
wantTypes: map[string]map[string]*TypeDef{ wantTypes: map[string]map[string]*TypeDef{
"main": { "main": {
"Title": { "Title": {
Name: "Title", Name: "Title",
Type: "string", DocComments: []string{"// Title is a title"},
Type: "string",
Consts: []*ConstDef{ Consts: []*ConstDef{
{ {
Name: "Mister", Name: "Mister",
DocComment: "Mister is a title", DocComments: []string{"// Mister is a title"},
Value: `"Mr"`, Value: `"Mr"`,
}, },
{ {
Name: "Miss", Name: "Miss",
@ -119,131 +120,8 @@ func TestParseEnum(t *testing.T) {
wantModels: map[string]map[string]*StructDef{ wantModels: map[string]map[string]*StructDef{
"main": { "main": {
"Person": { "Person": {
Name: "Person", Name: "Person",
Fields: []*Field{ DocComments: []string{"// Person represents a person"},
{
Name: "Title",
Type: &ParameterType{
Package: "main",
Name: "Title",
IsEnum: true,
},
},
{
Name: "Name",
Type: &ParameterType{
Package: "main",
Name: "string",
},
},
},
},
},
},
},
{
name: "should find a bound service with an enum interface",
dir: "testdata/enum-interface",
wantErr: false,
wantBoundMethods: map[string]map[string][]*BoundMethod{
"main": {
"GreetService": {
{
Package: "main",
Name: "Greet",
DocComment: "Greet does XYZ",
Inputs: []*Parameter{
{
Name: "name",
Type: &ParameterType{
Package: "main",
Name: "string",
},
},
{
Name: "title",
Type: &ParameterType{
Package: "main",
Name: "Title",
IsEnum: true,
},
},
},
Outputs: []*Parameter{
{
Name: "",
Type: &ParameterType{
Package: "main",
Name: "string",
},
},
},
ID: 1411160069,
},
{
Package: "main",
Name: "NewPerson",
DocComment: "NewPerson creates a new person",
Inputs: []*Parameter{
{
Name: "name",
Type: &ParameterType{
Package: "main",
Name: "string",
},
},
},
Outputs: []*Parameter{
{
Type: &ParameterType{
Package: "main",
Name: "Person",
IsStruct: true,
IsPointer: true,
},
},
},
ID: 1661412647,
},
},
},
},
wantTypes: map[string]map[string]*TypeDef{
"main": {
"Title": {
Name: "Title",
Type: "string",
Consts: []*ConstDef{
{
Name: "Mister",
DocComment: "Mister is a title",
Value: `"Mr"`,
},
{
Name: "Miss",
Value: `"Miss"`,
},
{
Name: "Ms",
Value: `"Ms"`,
},
{
Name: "Mrs",
Value: `"Mrs"`,
},
{
Name: "Dr",
Value: `"Dr"`,
},
},
ShouldGenerate: true,
},
},
},
wantModels: map[string]map[string]*StructDef{
"main": {
"Person": {
Name: "Person",
Fields: []*Field{ Fields: []*Field{
{ {
Name: "Title", Name: "Title",
@ -273,6 +151,36 @@ func TestParseEnum(t *testing.T) {
t.Errorf("ParseDirectory() error = %v, wantErr %v", err, tt.wantErr) t.Errorf("ParseDirectory() error = %v, wantErr %v", err, tt.wantErr)
return return
} }
// Patch the PackageDir in the wantBoundMethods
for _, packageData := range got.BoundMethods {
for _, boundMethods := range packageData {
for _, boundMethod := range boundMethods {
boundMethod.PackageDir = ""
}
}
}
// Loop over the things we want
for packageName, packageData := range tt.wantBoundMethods {
for structName, wantBoundMethods := range packageData {
gotBoundMethods := got.BoundMethods[packageName][structName]
if diff := cmp.Diff(wantBoundMethods, gotBoundMethods); diff != "" {
t.Errorf("ParseDirectory() failed:\n" + diff)
}
}
}
// Loop over the models
for _, packageData := range got.Models {
for _, wantModel := range packageData {
// Loop over the Fields
for _, field := range wantModel.Fields {
field.Project = nil
}
}
}
if diff := cmp.Diff(tt.wantBoundMethods, got.BoundMethods); diff != "" { if diff := cmp.Diff(tt.wantBoundMethods, got.BoundMethods); diff != "" {
t.Errorf("ParseDirectory() failed:\n" + diff) t.Errorf("ParseDirectory() failed:\n" + diff)
} }

View File

@ -111,22 +111,23 @@ func TestParseFunction(t *testing.T) {
}, },
}, },
}, },
"github.com/wailsapp/wails/v3/internal/parser/testdata/variable_single_from_other_function/services": { "github.com/wailsapp/wails/v3/internal/parser/testdata/function_from_imported_package/services": {
"OtherService": { "OtherService": {
{ {
Package: "github.com/wailsapp/wails/v3/internal/parser/testdata/variable_single_from_other_function/services", Package: "github.com/wailsapp/wails/v3/internal/parser/testdata/function_from_imported_package/services",
Name: "Yay", Name: "Yay",
DocComment: "Yay does this and that",
Outputs: []*Parameter{ Outputs: []*Parameter{
{ {
Type: &ParameterType{ Type: &ParameterType{
Name: "Address", Name: "Address",
IsStruct: true, IsStruct: true,
IsPointer: true, IsPointer: true,
Package: "github.com/wailsapp/wails/v3/internal/parser/testdata/variable_single_from_other_function/services", Package: "github.com/wailsapp/wails/v3/internal/parser/testdata/function_from_imported_package/services",
}, },
}, },
}, },
ID: 302702907, ID: 1592414782,
}, },
}, },
}, },
@ -134,7 +135,8 @@ func TestParseFunction(t *testing.T) {
wantModels: map[string]map[string]*StructDef{ wantModels: map[string]map[string]*StructDef{
"main": { "main": {
"Person": { "Person": {
Name: "Person", Name: "Person",
DocComments: []string{"// Person is a person"},
Fields: []*Field{ Fields: []*Field{
{ {
Name: "Name", Name: "Name",
@ -149,34 +151,34 @@ func TestParseFunction(t *testing.T) {
Name: "Address", Name: "Address",
IsStruct: true, IsStruct: true,
IsPointer: true, IsPointer: true,
Package: "github.com/wailsapp/wails/v3/internal/parser/testdata/variable_single_from_other_function/services", Package: "github.com/wailsapp/wails/v3/internal/parser/testdata/function_from_imported_package/services",
}, },
}, },
}, },
}, },
}, },
"github.com/wailsapp/wails/v3/internal/parser/testdata/variable_single_from_other_function/services": { "github.com/wailsapp/wails/v3/internal/parser/testdata/function_from_imported_package/services": {
"Address": { "Address": {
Name: "Address", Name: "Address",
Fields: []*Field{ Fields: []*Field{
{ {
Name: "Street", Name: "Street",
Type: &ParameterType{ Type: &ParameterType{
Package: "github.com/wailsapp/wails/v3/internal/parser/testdata/variable_single_from_other_function/services", Package: "github.com/wailsapp/wails/v3/internal/parser/testdata/function_from_imported_package/services",
Name: "string", Name: "string",
}, },
}, },
{ {
Name: "State", Name: "State",
Type: &ParameterType{ Type: &ParameterType{
Package: "github.com/wailsapp/wails/v3/internal/parser/testdata/variable_single_from_other_function/services", Package: "github.com/wailsapp/wails/v3/internal/parser/testdata/function_from_imported_package/services",
Name: "string", Name: "string",
}, },
}, },
{ {
Name: "Country", Name: "Country",
Type: &ParameterType{ Type: &ParameterType{
Package: "github.com/wailsapp/wails/v3/internal/parser/testdata/variable_single_from_other_function/services", Package: "github.com/wailsapp/wails/v3/internal/parser/testdata/function_from_imported_package/services",
Name: "string", Name: "string",
}, },
}, },
@ -193,8 +195,40 @@ func TestParseFunction(t *testing.T) {
t.Errorf("ParseDirectory() error = %v, wantErr %v", err, tt.wantErr) t.Errorf("ParseDirectory() error = %v, wantErr %v", err, tt.wantErr)
return return
} }
if diff := cmp.Diff(tt.wantBoundMethods, got.BoundMethods); diff != "" {
t.Errorf("ParseDirectory() failed:\n" + diff) // Patch the PackageDir in the wantBoundMethods
for _, packageData := range got.BoundMethods {
for _, boundMethods := range packageData {
for _, boundMethod := range boundMethods {
boundMethod.PackageDir = ""
}
}
}
// Loop over the things we want
for packageName, packageData := range tt.wantBoundMethods {
for structName, wantBoundMethods := range packageData {
gotBoundMethods := got.BoundMethods[packageName][structName]
if diff := cmp.Diff(wantBoundMethods, gotBoundMethods); diff != "" {
t.Errorf("ParseDirectory() failed:\n" + diff)
}
}
}
// Loop over the models
for _, packageData := range got.Models {
for _, wantModel := range packageData {
// Loop over the Fields
for _, field := range wantModel.Fields {
field.Project = nil
}
}
}
if !reflect.DeepEqual(tt.wantBoundMethods, got.BoundMethods) {
t.Errorf("ParseDirectory() failed:\n" + cmp.Diff(tt.wantBoundMethods, got.BoundMethods))
//spew.Dump(tt.wantBoundMethods)
//spew.Dump(got.BoundMethods)
} }
if !reflect.DeepEqual(tt.wantModels, got.Models) { if !reflect.DeepEqual(tt.wantModels, got.Models) {
t.Errorf("ParseDirectory() failed:\n" + cmp.Diff(tt.wantModels, got.Models)) t.Errorf("ParseDirectory() failed:\n" + cmp.Diff(tt.wantModels, got.Models))

View File

@ -163,8 +163,9 @@ func TestParseStructLiteralMultiple(t *testing.T) {
"github.com/wailsapp/wails/v3/internal/parser/testdata/struct_literal_multiple_other/services": { "github.com/wailsapp/wails/v3/internal/parser/testdata/struct_literal_multiple_other/services": {
"OtherService": { "OtherService": {
{ {
Package: "github.com/wailsapp/wails/v3/internal/parser/testdata/struct_literal_multiple_other/services", Package: "github.com/wailsapp/wails/v3/internal/parser/testdata/struct_literal_multiple_other/services",
Name: "Yay", Name: "Yay",
DocComment: "Yay does this and that",
Outputs: []*Parameter{ Outputs: []*Parameter{
{ {
Type: &ParameterType{ Type: &ParameterType{
@ -242,6 +243,36 @@ func TestParseStructLiteralMultiple(t *testing.T) {
t.Errorf("ParseDirectory() error = %v, wantErr %v", err, tt.wantErr) t.Errorf("ParseDirectory() error = %v, wantErr %v", err, tt.wantErr)
return return
} }
// Patch the PackageDir in the wantBoundMethods
for _, packageData := range got.BoundMethods {
for _, boundMethods := range packageData {
for _, boundMethod := range boundMethods {
boundMethod.PackageDir = ""
}
}
}
// Loop over the things we want
for packageName, packageData := range tt.wantBoundMethods {
for structName, wantBoundMethods := range packageData {
gotBoundMethods := got.BoundMethods[packageName][structName]
if diff := cmp.Diff(wantBoundMethods, gotBoundMethods); diff != "" {
t.Errorf("ParseDirectory() failed:\n" + diff)
}
}
}
// Loop over the models
for _, packageData := range got.Models {
for _, wantModel := range packageData {
// Loop over the Fields
for _, field := range wantModel.Fields {
field.Project = nil
}
}
}
if diff := cmp.Diff(tt.wantBoundMethods, got.BoundMethods); diff != "" { if diff := cmp.Diff(tt.wantBoundMethods, got.BoundMethods); diff != "" {
t.Errorf("ParseDirectory() failed:\n" + diff) t.Errorf("ParseDirectory() failed:\n" + diff)
} }

View File

@ -1119,6 +1119,36 @@ func TestParseStructLiteralNonPointerSingle(t *testing.T) {
t.Errorf("ParseDirectory() error = %v, wantErr %v", err, tt.wantErr) t.Errorf("ParseDirectory() error = %v, wantErr %v", err, tt.wantErr)
return return
} }
// Patch the PackageDir in the wantBoundMethods
for _, packageData := range got.BoundMethods {
for _, boundMethods := range packageData {
for _, boundMethod := range boundMethods {
boundMethod.PackageDir = ""
}
}
}
// Loop over the things we want
for packageName, packageData := range tt.wantBoundMethods {
for structName, wantBoundMethods := range packageData {
gotBoundMethods := got.BoundMethods[packageName][structName]
if diff := cmp.Diff(wantBoundMethods, gotBoundMethods); diff != "" {
t.Errorf("ParseDirectory() failed:\n" + diff)
}
}
}
// Loop over the models
for _, packageData := range got.Models {
for _, wantModel := range packageData {
// Loop over the Fields
for _, field := range wantModel.Fields {
field.Project = nil
}
}
}
if diff := cmp.Diff(tt.wantBoundMethods, got.BoundMethods); diff != "" { if diff := cmp.Diff(tt.wantBoundMethods, got.BoundMethods); diff != "" {
t.Errorf("ParseDirectory() failed:\n" + diff) t.Errorf("ParseDirectory() failed:\n" + diff)
} }

View File

@ -1120,6 +1120,36 @@ func TestParseStructLiteralSingle(t *testing.T) {
t.Errorf("ParseDirectory() error = %v, wantErr %v", err, tt.wantErr) t.Errorf("ParseDirectory() error = %v, wantErr %v", err, tt.wantErr)
return return
} }
// Patch the PackageDir in the wantBoundMethods
for _, packageData := range got.BoundMethods {
for _, boundMethods := range packageData {
for _, boundMethod := range boundMethods {
boundMethod.PackageDir = ""
}
}
}
// Loop over the things we want
for packageName, packageData := range tt.wantBoundMethods {
for structName, wantBoundMethods := range packageData {
gotBoundMethods := got.BoundMethods[packageName][structName]
if diff := cmp.Diff(wantBoundMethods, gotBoundMethods); diff != "" {
t.Errorf("ParseDirectory() failed:\n" + diff)
}
}
}
// Loop over the models
for _, packageData := range got.Models {
for _, wantModel := range packageData {
// Loop over the Fields
for _, field := range wantModel.Fields {
field.Project = nil
}
}
}
if diff := cmp.Diff(tt.wantBoundMethods, got.BoundMethods); diff != "" { if diff := cmp.Diff(tt.wantBoundMethods, got.BoundMethods); diff != "" {
t.Errorf("ParseDirectory() failed:\n" + diff) t.Errorf("ParseDirectory() failed:\n" + diff)
} }

View File

@ -149,8 +149,9 @@ func TestParseVariableSingle(t *testing.T) {
"github.com/wailsapp/wails/v3/internal/parser/testdata/variable_single_from_other_function/services": { "github.com/wailsapp/wails/v3/internal/parser/testdata/variable_single_from_other_function/services": {
"OtherService": { "OtherService": {
{ {
Package: "github.com/wailsapp/wails/v3/internal/parser/testdata/variable_single_from_other_function/services", Package: "github.com/wailsapp/wails/v3/internal/parser/testdata/variable_single_from_other_function/services",
Name: "Yay", Name: "Yay",
DocComment: "Yay does this and that",
Outputs: []*Parameter{ Outputs: []*Parameter{
{ {
Type: &ParameterType{ Type: &ParameterType{
@ -169,7 +170,8 @@ func TestParseVariableSingle(t *testing.T) {
wantModels: map[string]map[string]*StructDef{ wantModels: map[string]map[string]*StructDef{
"main": { "main": {
"Person": { "Person": {
Name: "Person", Name: "Person",
DocComments: []string{"// Person is a person!", "// They have a name and an address"},
Fields: []*Field{ Fields: []*Field{
{ {
Name: "Name", Name: "Name",
@ -228,6 +230,36 @@ func TestParseVariableSingle(t *testing.T) {
t.Errorf("ParseDirectory() error = %v, wantErr %v", err, tt.wantErr) t.Errorf("ParseDirectory() error = %v, wantErr %v", err, tt.wantErr)
return return
} }
// Patch the PackageDir in the wantBoundMethods
for _, packageData := range got.BoundMethods {
for _, boundMethods := range packageData {
for _, boundMethod := range boundMethods {
boundMethod.PackageDir = ""
}
}
}
// Loop over the things we want
for packageName, packageData := range tt.wantBoundMethods {
for structName, wantBoundMethods := range packageData {
gotBoundMethods := got.BoundMethods[packageName][structName]
if diff := cmp.Diff(wantBoundMethods, gotBoundMethods); diff != "" {
t.Errorf("ParseDirectory() failed:\n" + diff)
}
}
}
// Loop over the models
for _, packageData := range got.Models {
for _, wantModel := range packageData {
// Loop over the Fields
for _, field := range wantModel.Fields {
field.Project = nil
}
}
}
if diff := cmp.Diff(tt.wantBoundMethods, got.BoundMethods); diff != "" { if diff := cmp.Diff(tt.wantBoundMethods, got.BoundMethods); diff != "" {
t.Errorf("ParseDirectory() failed:\n" + diff) t.Errorf("ParseDirectory() failed:\n" + diff)
} }

View File

@ -1,20 +1,26 @@
{{$pkg := .Package}} {{- $pkg := .Package}}{{- range .Imports}}
export namespace {{.Package}} { import * as {{.PackageName}} from "{{.Path}}/models";{{- end}}
{{range $enumindex, $enumdef := .Enums}} {{- range $enumindex, $enumdef := .Enums}}
{{- range $commentindex, $commentdef := .DocComments}} {{- range $commentindex, $commentdef := $enumdef.DocComments}}
{{$commentdef -}} {{$commentdef -}}
{{- end}}
export enum {{$enumdef.Name}} {
{{- range $constindex, $constdef := .Consts}}
{{- if $constdef.DocComments}}
{{- range $commentindex, $commentdef := $constdef.DocComments}}
{{$commentdef -}}
{{- end }}
{{- end}} {{- end}}
export enum {{$enumdef.Name}} { {{$constdef.Name}} = {{$constdef.Value}},{{end}}
{{- range $constindex, $constdef := .Consts}}
{{- if $constdef.DocComment}}
// {{$constdef.DocComment}}
{{- end}}
{{$constdef.Name}} = {{$constdef.Value}},{{end}}
}
{{- end}}
{{range $name, $def := .Models}}
export interface {{$def.Name}} { {{range $def.Fields}}
{{.JSDef $pkg}}{{end}}
}
{{end}}
} }
{{- end}}
{{range $name, $def := .Models}}
{{- if $def.DocComments}}
{{- range $commentindex, $commentdef := $def.DocComments}}
{{$commentdef -}}
{{- end }}
{{- end}}
export interface {{$def.Name}} { {{- range $def.Fields}}
{{.JSDef $pkg}}{{end}}
}
{{end}}

View File

@ -1,21 +1,32 @@
{{$pkg := .Package}} {{$pkg := .Package}}
// Defining the {{$pkg}} namespace {{- if .Imports }}
export const {{$pkg}} = {}; /**
{{range $enumindex, $enumdef := .Enums}} {{- range .Imports}}
// Simulating the enum with an object * @typedef {import('{{.Path}}/models').{{.Name -}} } {{.VarName}}
{{$pkg}}.{{$enumdef.Name}} = { {{- end}}
*/
{{end}}
{{- range $enumindex, $enumdef := .Enums}}
{{- range $commentindex, $commentdef := $enumdef.DocComments}}
{{$commentdef -}}
{{- end}}
export const {{$enumdef.Name}} = {
{{- range $constindex, $constdef := .Consts}} {{- range $constindex, $constdef := .Consts}}
{{- if $constdef.DocComment}} {{- if $constdef.DocComments}}
// {{$constdef.DocComment}} {{- range $commentindex, $commentdef := $constdef.DocComments}}
{{$commentdef -}}
{{- end }}
{{- end}} {{- end}}
{{$constdef.Name}}: {{$constdef.Value}},{{end}} {{$constdef.Name}}: {{$constdef.Value}},{{end}}
}; };
{{end}}
{{- range $name, $def := .Models}}
{{- if $def.DocComments}}
{{- range $commentindex, $commentdef := $def.DocComments}}
{{$commentdef -}}
{{- end }}
{{- end}} {{- end}}
{{range $name, $def := .Models}} export const {{$def.Name}} = class {
{{- if $def.DocComment}}
// {{$def.DocComment}}
{{- end -}}
{{$pkg}}.{{$def.Name}} = class {
/** /**
* Creates a new {{$def.Name}} instance. * Creates a new {{$def.Name}} instance.
* @constructor * @constructor
@ -31,11 +42,11 @@ export const {{$pkg}} = {};
/** /**
* Creates a new {{$def.Name}} instance from a string or object. * Creates a new {{$def.Name}} instance from a string or object.
* @param {string|object} source - The source data to create a {{$def.Name}} instance from. * @param {string|object} source - The source data to create a {{$def.Name}} instance from.
* @returns {{$pkg}}.{{$def.Name}} A new {{$def.Name}} instance. * @returns { {{- $def.Name -}} } A new {{$def.Name}} instance.
*/ */
static createFrom(source = {}) { static createFrom(source) {
let parsedSource = typeof source === 'string' ? JSON.parse(source) : source; let parsedSource = typeof source === 'string' ? JSON.parse(source) : source;
return new {{$pkg}}.{{$def.Name}}(parsedSource); return new {{$def.Name}}(parsedSource);
} }
}; };
{{end}} {{end}}

View File

@ -1,31 +1,38 @@
{{$pkg := .Package}} {{- $pkg := .Package}}{{- range .Imports}}
export namespace {{.Package}} { import * as {{.PackageName}} from "{{.Path}}/models";{{- end}}
{{range $enumindex, $enumdef := .Enums}} {{- range $enumindex, $enumdef := .Enums}}
{{- range $commentindex, $commentdef := .DocComments}} {{- range $commentindex, $commentdef := $enumdef.DocComments}}
{{$commentdef -}} {{$commentdef -}}
{{- end}}
export enum {{$enumdef.Name}} {
{{- range $constindex, $constdef := .Consts}}
{{- if $constdef.DocComments}}
{{- range $commentindex, $commentdef := $constdef.DocComments}}
{{$commentdef -}}
{{- end }}
{{- end}} {{- end}}
export enum {{$enumdef.Name}} { {{$constdef.Name}} = {{$constdef.Value}},{{end}}
{{- range $constindex, $constdef := .Consts}}
{{- if $constdef.DocComment}}
// {{$constdef.DocComment}}
{{- end}}
{{$constdef.Name}} = {{$constdef.Value}},{{end}}
}
{{- end}}
{{range $name, $def := .Models}}
export class {{$def.Name}} {
{{range $def.Fields}}{{.JSDef $pkg}}
{{end}}
constructor(source: Partial<{{$def.Name}}> = {}) {
const { {{$def.DefaultValueList}} } = source; {{range $def.Fields}}
this.{{.JSName}} = {{.JSName}};{{end}}
}
static createFrom(source: string | object = {}): {{$def.Name}} {
let parsedSource = typeof source === 'string' ? JSON.parse(source) : source;
return new {{$def.Name}}(parsedSource as Partial<{{$def.Name}}>);
}
}
{{end}}
} }
{{- end}}
{{range $name, $def := .Models}}
{{- if $def.DocComments}}
{{- range $commentindex, $commentdef := $def.DocComments}}
{{$commentdef -}}
{{- end }}
{{- end}}
export class {{$def.Name}} {
{{- range $def.Fields}}
{{.JSDef $pkg}}{{end}}
constructor(source: Partial<{{$def.Name}}> = {}) {
const { {{- $def.DefaultValueList -}} } = source;
{{- range $def.Fields}}
this.{{.JSName}} = {{.JSName}};{{end}}
}
static createFrom(source: string | object = {}): {{$def.Name}} {
let parsedSource = typeof source === 'string' ? JSON.parse(source) : source;
return new {{$def.Name}}(parsedSource as Partial<{{$def.Name}}>);
}
}
{{end}}

View File

@ -1,29 +0,0 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
/**
* @typedef {import('./models').main.Title} mainTitle
* @typedef {import('./models').main.Person} mainPerson
*/
export const GreetService = {
/**
* GreetService.Greet
* Greet does XYZ
* @param name {string}
* @param title {mainTitle}
* @returns {Promise<string>}
**/
Greet: function(name, title) { return wails.CallByID(1411160069, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.NewPerson
* NewPerson creates a new person
* @param name {string}
* @returns {Promise<mainPerson>}
**/
NewPerson: function(name) { return wails.CallByID(1661412647, ...Array.prototype.slice.call(arguments, 0)); },
};

View File

@ -1,29 +0,0 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
/**
* @typedef {import('./models').main.Title} mainTitle
* @typedef {import('./models').main.Person} mainPerson
*/
export const GreetService = {
/**
* GreetService.Greet
* Greet does XYZ
* @param name {string}
* @param title {mainTitle}
* @returns {Promise<string>}
**/
Greet: function(name, title) { return wails.CallByName("main.GreetService.Greet", ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.NewPerson
* NewPerson creates a new person
* @param name {string}
* @returns {Promise<mainPerson>}
**/
NewPerson: function(name) { return wails.CallByName("main.GreetService.NewPerson", ...Array.prototype.slice.call(arguments, 0)); },
};

View File

@ -1,21 +0,0 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
export namespace main {
export enum Title {
// Mister is a title
Mister = "Mr",
Miss = "Miss",
Ms = "Ms",
Mrs = "Mrs",
Dr = "Dr",
}
export interface Person {
title: Title;
name: string;
}
}

View File

@ -1,29 +0,0 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
/**
* @typedef {import('./models').main.Title} mainTitle
* @typedef {import('./models').main.Person} mainPerson
*/
export const GreetService = {
/**
* GreetService.Greet
* Greet does XYZ
* @param name {string}
* @param title {mainTitle}
* @returns {Promise<string>}
**/
Greet: function(name, title) { return wails.CallByID(1411160069, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.NewPerson
* NewPerson creates a new person
* @param name {string}
* @returns {Promise<mainPerson>}
**/
NewPerson: function(name) { return wails.CallByID(1661412647, ...Array.prototype.slice.call(arguments, 0)); },
};

View File

@ -1,29 +0,0 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
/**
* @typedef {import('./models').main.Title} mainTitle
* @typedef {import('./models').main.Person} mainPerson
*/
export const GreetService = {
/**
* GreetService.Greet
* Greet does XYZ
* @param name {string}
* @param title {mainTitle}
* @returns {Promise<string>}
**/
Greet: function(name, title) { return wails.CallByName("main.GreetService.Greet", ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.NewPerson
* NewPerson creates a new person
* @param name {string}
* @returns {Promise<mainPerson>}
**/
NewPerson: function(name) { return wails.CallByName("main.GreetService.NewPerson", ...Array.prototype.slice.call(arguments, 0)); },
};

View File

@ -0,0 +1,29 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
/**
* @typedef {import('./models').Person} Person
* @typedef {import('./models').Title} Title
*/
/**
* Greet does XYZ
* @function Greet
* @param name {string}
* @param title {Title}
* @returns {Promise<string>}
**/
export function Greet(name, title) {
return wails.CallByID(1411160069, ...Array.prototype.slice.call(arguments, 0));
}
/**
* NewPerson creates a new person
* @function NewPerson
* @param name {string}
* @returns {Promise<Person>}
**/
export function NewPerson(name) {
return wails.CallByID(1661412647, ...Array.prototype.slice.call(arguments, 0));
}

View File

@ -0,0 +1,29 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
/**
* @typedef {import('./models').Person} Person
* @typedef {import('./models').Title} Title
*/
/**
* Greet does XYZ
* @function Greet
* @param name {string}
* @param title {Title}
* @returns {Promise<string>}
**/
export function Greet(name, title) {
return wails.CallByName("main.GreetService.Greet", ...Array.prototype.slice.call(arguments, 0));
}
/**
* NewPerson creates a new person
* @function NewPerson
* @param name {string}
* @returns {Promise<Person>}
**/
export function NewPerson(name) {
return wails.CallByName("main.GreetService.NewPerson", ...Array.prototype.slice.call(arguments, 0));
}

View File

@ -0,0 +1,19 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
// Title is a title
export enum Title {
// Mister is a title
Mister = "Mr",
Miss = "Miss",
Ms = "Ms",
Mrs = "Mrs",
Dr = "Dr",
}
// Person represents a person
export interface Person {
title: Title;
name: string;
}

View File

@ -2,11 +2,8 @@
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT // This file is automatically generated. DO NOT EDIT
// Defining the main namespace // Title is a title
export const main = {}; export const Title = {
// Simulating the enum with an object
main.Title = {
// Mister is a title // Mister is a title
Mister: "Mr", Mister: "Mr",
Miss: "Miss", Miss: "Miss",
@ -14,12 +11,14 @@ main.Title = {
Mrs: "Mrs", Mrs: "Mrs",
Dr: "Dr", Dr: "Dr",
}; };
main.Person = class {
// Person represents a person
export const Person = class {
/** /**
* Creates a new Person instance. * Creates a new Person instance.
* @constructor * @constructor
* @param {Object} source - The source object to create the Person. * @param {Object} source - The source object to create the Person.
* @param {main.Title} source.Title * @param {Title} source.Title
* @param {string} source.Name * @param {string} source.Name
*/ */
constructor(source = {}) { constructor(source = {}) {
@ -31,11 +30,11 @@ main.Person = class {
/** /**
* Creates a new Person instance from a string or object. * Creates a new Person instance from a string or object.
* @param {string|object} source - The source data to create a Person instance from. * @param {string|object} source - The source data to create a Person instance from.
* @returns main.Person A new Person instance. * @returns {Person} A new Person instance.
*/ */
static createFrom(source = {}) { static createFrom(source) {
let parsedSource = typeof source === 'string' ? JSON.parse(source) : source; let parsedSource = typeof source === 'string' ? JSON.parse(source) : source;
return new main.Person(parsedSource); return new Person(parsedSource);
} }
}; };

View File

@ -0,0 +1,30 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
// Title is a title
export enum Title {
// Mister is a title
Mister = "Mr",
Miss = "Miss",
Ms = "Ms",
Mrs = "Mrs",
Dr = "Dr",
}
// Person represents a person
export class Person {
title: Title;
name: string;
constructor(source: Partial<Person> = {}) {
const {title = null, name = ""} = source;
this.title = title;
this.name = name;
}
static createFrom(source: string | object = {}): Person {
let parsedSource = typeof source === 'string' ? JSON.parse(source) : source;
return new Person(parsedSource as Partial<Person>);
}
}

View File

@ -7,6 +7,7 @@ import (
"github.com/wailsapp/wails/v3/pkg/application" "github.com/wailsapp/wails/v3/pkg/application"
) )
// Title is a title
type Title string type Title string
const ( const (

View File

@ -1,33 +0,0 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
export namespace main {
export enum Title {
// Mister is a title
Mister = "Mr",
Miss = "Miss",
Ms = "Ms",
Mrs = "Mrs",
Dr = "Dr",
}
export class Person {
title: Title;
name: string;
constructor(source: Partial<Person> = {}) {
const { title = null, name = "" } = source;
this.title = title;
this.name = name;
}
static createFrom(source: string | object = {}): Person {
let parsedSource = typeof source === 'string' ? JSON.parse(source) : source;
return new Person(parsedSource as Partial<Person>);
}
}
}

View File

@ -1,20 +0,0 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
/**
* @typedef {import('./models').services.Title} servicesTitle
*/
export const GreetService = {
/**
* GreetService.Greet
* Greet does XYZ
* @param name {string}
* @param title {servicesTitle}
* @returns {Promise<string>}
**/
Greet: function(name, title) { return wails.CallByID(1411160069, ...Array.prototype.slice.call(arguments, 0)); },
};

View File

@ -1,20 +0,0 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
/**
* @typedef {import('./models').services.Title} servicesTitle
*/
export const GreetService = {
/**
* GreetService.Greet
* Greet does XYZ
* @param name {string}
* @param title {servicesTitle}
* @returns {Promise<string>}
**/
Greet: function(name, title) { return wails.CallByName("main.GreetService.Greet", ...Array.prototype.slice.call(arguments, 0)); },
};

View File

@ -0,0 +1,18 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
/**
* @typedef {import('../services/models').Title} servicesTitle
*/
/**
* Greet does XYZ
* @function Greet
* @param name {string}
* @param title {servicesTitle}
* @returns {Promise<string>}
**/
export function Greet(name, title) {
return wails.CallByID(1411160069, ...Array.prototype.slice.call(arguments, 0));
}

View File

@ -0,0 +1,18 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
/**
* @typedef {import('../services/models').Title} servicesTitle
*/
/**
* Greet does XYZ
* @function Greet
* @param name {string}
* @param title {servicesTitle}
* @returns {Promise<string>}
**/
export function Greet(name, title) {
return wails.CallByName("main.GreetService.Greet", ...Array.prototype.slice.call(arguments, 0));
}

View File

@ -0,0 +1,12 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
export enum Title {
// Mister is a title
Mister = "Mr",
Miss = "Miss",
Ms = "Ms",
Mrs = "Mrs",
Dr = "Dr",
}

View File

@ -2,11 +2,7 @@
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT // This file is automatically generated. DO NOT EDIT
// Defining the services namespace export const Title = {
export const services = {};
// Simulating the enum with an object
services.Title = {
// Mister is a title // Mister is a title
Mister: "Mr", Mister: "Mr",
Miss: "Miss", Miss: "Miss",

View File

@ -0,0 +1,12 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
export enum Title {
// Mister is a title
Mister = "Mr",
Miss = "Miss",
Ms = "Ms",
Mrs = "Mrs",
Dr = "Dr",
}

View File

@ -1,16 +0,0 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
export namespace services {
export enum Title {
// Mister is a title
Mister = "Mr",
Miss = "Miss",
Ms = "Ms",
Mrs = "Mrs",
Dr = "Dr",
}
}

View File

@ -1,27 +0,0 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
/**
* @typedef {import('./models').main.Person} mainPerson
*/
export const GreetService = {
/**
* GreetService.Greet
* Greet does XYZ
* @param name {string}
* @returns {Promise<string>}
**/
Greet: function(name) { return wails.CallByID(1411160069, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.NewPerson
* NewPerson creates a new person
* @param name {string}
* @returns {Promise<mainPerson>}
**/
NewPerson: function(name) { return wails.CallByID(1661412647, ...Array.prototype.slice.call(arguments, 0)); },
};

View File

@ -1,19 +0,0 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
/**
* @typedef {import('./models').services.Address} servicesAddress
*/
export const OtherService = {
/**
* OtherService.Yay
*
*
* @returns {Promise<servicesAddress>}
**/
Yay: function() { return wails.CallByID(302702907, ...Array.prototype.slice.call(arguments, 0)); },};

View File

@ -1,19 +0,0 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
/**
* @typedef {import('./models').services.Address} servicesAddress
*/
export const OtherService = {
/**
* OtherService.Yay
*
*
* @returns {Promise<servicesAddress>}
**/
Yay: function() { return wails.CallByID(302702907, ...Array.prototype.slice.call(arguments, 0)); },
};

View File

@ -0,0 +1 @@
map[string]map[string][]*parser.BoundMethod{"github.com/wailsapp/wails/v3/internal/parser/testdata/function_from_imported_package/services":map[string][]*parser.BoundMethod{"OtherService":[]*parser.BoundMethod{(*parser.BoundMethod)(0xc000148000)}}, "main":map[string][]*parser.BoundMethod{"GreetService":[]*parser.BoundMethod{(*parser.BoundMethod)(0xc0000c8a80), (*parser.BoundMethod)(0xc0000c8b00)}}}

View File

@ -0,0 +1,27 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
/**
* @typedef {import('./models').Person} Person
*/
/**
* Greet does XYZ
* @function Greet
* @param name {string}
* @returns {Promise<string>}
**/
export function Greet(name) {
return wails.CallByID(1411160069, ...Array.prototype.slice.call(arguments, 0));
}
/**
* NewPerson creates a new person
* @function NewPerson
* @param name {string}
* @returns {Promise<Person>}
**/
export function NewPerson(name) {
return wails.CallByID(1661412647, ...Array.prototype.slice.call(arguments, 0));
}

View File

@ -0,0 +1,27 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
/**
* @typedef {import('./models').Person} Person
*/
/**
* Greet does XYZ
* @function Greet
* @param name {string}
* @returns {Promise<string>}
**/
export function Greet(name) {
return wails.CallByName("main.GreetService.Greet", ...Array.prototype.slice.call(arguments, 0));
}
/**
* NewPerson creates a new person
* @function NewPerson
* @param name {string}
* @returns {Promise<Person>}
**/
export function NewPerson(name) {
return wails.CallByName("main.GreetService.NewPerson", ...Array.prototype.slice.call(arguments, 0));
}

View File

@ -0,0 +1,11 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
import * as services from "../services/models";
// Person is a person
export interface Person {
name: string;
address: services.Address;
}

View File

@ -0,0 +1,34 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
/**
* @typedef {import('../services/models').Address} servicesAddress
*/
// Person is a person
export const Person = class {
/**
* Creates a new Person instance.
* @constructor
* @param {Object} source - The source object to create the Person.
* @param {string} source.Name
* @param {servicesAddress} source.Address
*/
constructor(source = {}) {
const { name = "", address = null } = source;
this.name = name;
this.address = address;
}
/**
* Creates a new Person instance from a string or object.
* @param {string|object} source - The source data to create a Person instance from.
* @returns {Person} A new Person instance.
*/
static createFrom(source) {
let parsedSource = typeof source === 'string' ? JSON.parse(source) : source;
return new Person(parsedSource);
}
};

View File

@ -0,0 +1,22 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
import * as services from "../services/models";
// Person is a person
export class Person {
name: string;
address: services.Address;
constructor(source: Partial<Person> = {}) {
const {name = "", address = null} = source;
this.name = name;
this.address = address;
}
static createFrom(source: string | object = {}): Person {
let parsedSource = typeof source === 'string' ? JSON.parse(source) : source;
return new Person(parsedSource as Partial<Person>);
}
}

View File

@ -0,0 +1,16 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
/**
* @typedef {import('./models').Address} Address
*/
/**
* Yay does this and that
* @function Yay
* @returns {Promise<Address>}
**/
export function Yay() {
return wails.CallByID(1592414782, ...Array.prototype.slice.call(arguments, 0));
}

View File

@ -0,0 +1,16 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
/**
* @typedef {import('./models').Address} Address
*/
/**
* Yay does this and that
* @function Yay
* @returns {Promise<Address>}
**/
export function Yay() {
return wails.CallByName("services.OtherService.Yay", ...Array.prototype.slice.call(arguments, 0));
}

View File

@ -2,4 +2,9 @@
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT // This file is automatically generated. DO NOT EDIT
// TODO : nothing generated yet
export interface Address {
street: string;
state: string;
country: string;
}

View File

@ -0,0 +1,31 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
export const Address = class {
/**
* Creates a new Address instance.
* @constructor
* @param {Object} source - The source object to create the Address.
* @param {string} source.Street
* @param {string} source.State
* @param {string} source.Country
*/
constructor(source = {}) {
const { street = "", state = "", country = "" } = source;
this.street = street;
this.state = state;
this.country = country;
}
/**
* Creates a new Address instance from a string or object.
* @param {string|object} source - The source data to create a Address instance from.
* @returns {Address} A new Address instance.
*/
static createFrom(source) {
let parsedSource = typeof source === 'string' ? JSON.parse(source) : source;
return new Address(parsedSource);
}
};

View File

@ -0,0 +1,22 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
export class Address {
street: string;
state: string;
country: string;
constructor(source: Partial<Address> = {}) {
const {street = "", state = "", country = ""} = source;
this.street = street;
this.state = state;
this.country = country;
}
static createFrom(source: string | object = {}): Address {
let parsedSource = typeof source === 'string' ? JSON.parse(source) : source;
return new Address(parsedSource as Partial<Address>);
}
}

View File

@ -2,7 +2,7 @@ package main
import ( import (
_ "embed" _ "embed"
"github.com/wailsapp/wails/v3/internal/parser/testdata/variable_single_from_other_function/services" "github.com/wailsapp/wails/v3/internal/parser/testdata/function_from_imported_package/services"
"log" "log"
"github.com/wailsapp/wails/v3/pkg/application" "github.com/wailsapp/wails/v3/pkg/application"
@ -15,6 +15,7 @@ type GreetService struct {
target *Person target *Person
} }
// Person is a person
type Person struct { type Person struct {
Name string Name string
Address *services.Address Address *services.Address

View File

@ -1,63 +0,0 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
// Defining the main namespace
export const main = {};
main.Person = class {
/**
* Creates a new Person instance.
* @constructor
* @param {Object} source - The source object to create the Person.
* @param {string} source.Name
* @param {services.Address} source.Address
*/
constructor(source = {}) {
const { name = "", address = null } = source;
this.name = name;
this.address = address;
}
/**
* Creates a new Person instance from a string or object.
* @param {string|object} source - The source data to create a Person instance from.
* @returns main.Person A new Person instance.
*/
static createFrom(source = {}) {
let parsedSource = typeof source === 'string' ? JSON.parse(source) : source;
return new main.Person(parsedSource);
}
};
// Defining the services namespace
export const services = {};
services.Address = class {
/**
* Creates a new Address instance.
* @constructor
* @param {Object} source - The source object to create the Address.
* @param {string} source.Street
* @param {string} source.State
* @param {string} source.Country
*/
constructor(source = {}) {
const { street = "", state = "", country = "" } = source;
this.street = street;
this.state = state;
this.country = country;
}
/**
* Creates a new Address instance from a string or object.
* @param {string|object} source - The source data to create a Address instance from.
* @returns services.Address A new Address instance.
*/
static createFrom(source = {}) {
let parsedSource = typeof source === 'string' ? JSON.parse(source) : source;
return new services.Address(parsedSource);
}
};

View File

@ -1,48 +0,0 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
export namespace main {
export class Person {
name: string;
address: services.Address;
constructor(source: Partial<Person> = {}) {
const { name = "", address = null } = source;
this.name = name;
this.address = address;
}
static createFrom(source: string | object = {}): Person {
let parsedSource = typeof source === 'string' ? JSON.parse(source) : source;
return new Person(parsedSource as Partial<Person>);
}
}
}
export namespace services {
export class Address {
street: string;
state: string;
country: string;
constructor(source: Partial<Address> = {}) {
const { street = "", state = "", country = "" } = source;
this.street = street;
this.state = state;
this.country = country;
}
static createFrom(source: string | object = {}): Address {
let parsedSource = typeof source === 'string' ? JSON.parse(source) : source;
return new Address(parsedSource as Partial<Address>);
}
}
}

View File

@ -0,0 +1,27 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
/**
* @typedef {import('./models').Person} Person
*/
/**
* Greet does XYZ
* @function Greet
* @param name {string}
* @returns {Promise<string>}
**/
export function Greet(name) {
return wails.CallByID(1411160069, ...Array.prototype.slice.call(arguments, 0));
}
/**
* NewPerson creates a new person
* @function NewPerson
* @param name {string}
* @returns {Promise<Person>}
**/
export function NewPerson(name) {
return wails.CallByID(1661412647, ...Array.prototype.slice.call(arguments, 0));
}

View File

@ -0,0 +1,27 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
/**
* @typedef {import('./models').Person} Person
*/
/**
* Greet does XYZ
* @function Greet
* @param name {string}
* @returns {Promise<string>}
**/
export function Greet(name) {
return wails.CallByName("main.GreetService.Greet", ...Array.prototype.slice.call(arguments, 0));
}
/**
* NewPerson creates a new person
* @function NewPerson
* @param name {string}
* @returns {Promise<Person>}
**/
export function NewPerson(name) {
return wails.CallByName("main.GreetService.NewPerson", ...Array.prototype.slice.call(arguments, 0));
}

View File

@ -0,0 +1,17 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
export enum Title {
// Mister is a title
Mister = "Mr",
Miss = "Miss",
Ms = "Ms",
Mrs = "Mrs",
Dr = "Dr",
}
export interface Person {
title: Title;
name: string;
}

View File

@ -0,0 +1,16 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
/**
* @typedef {import('./models').Address} Address
*/
/**
* Yay does this and that
* @function Yay
* @returns {Promise<Address>}
**/
export function Yay() {
return wails.CallByID(2189323817, ...Array.prototype.slice.call(arguments, 0));
}

View File

@ -0,0 +1,16 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
/**
* @typedef {import('./models').Address} Address
*/
/**
* Yay does this and that
* @function Yay
* @returns {Promise<Address>}
**/
export function Yay() {
return wails.CallByName("other.OtherService.Yay", ...Array.prototype.slice.call(arguments, 0));
}

View File

@ -2,4 +2,8 @@
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT // This file is automatically generated. DO NOT EDIT
// TODO : nothing generated yet export interface Address {
Street: string;
State: string;
Country: string;
}

View File

@ -2,22 +2,12 @@ package main
import ( import (
_ "embed" _ "embed"
"github.com/wailsapp/wails/v3/internal/parser/testdata/function_from_nested_imported_package/services/other"
"log" "log"
"github.com/wailsapp/wails/v3/pkg/application" "github.com/wailsapp/wails/v3/pkg/application"
) )
type Title string
const (
// Mister is a title
Mister Title = "Mr"
Miss Title = "Miss"
Ms Title = "Ms"
Mrs Title = "Mrs"
Dr Title = "Dr"
)
// GreetService is great // GreetService is great
type GreetService struct { type GreetService struct {
SomeVariable int SomeVariable int
@ -26,13 +16,13 @@ type GreetService struct {
} }
type Person struct { type Person struct {
Title Title Name string
Name string Address *other.Address
} }
// Greet does XYZ // Greet does XYZ
func (*GreetService) Greet(name string, title Title) string { func (*GreetService) Greet(name string) string {
return "Hello " + string(title) + " " + name return "Hello " + name
} }
// NewPerson creates a new person // NewPerson creates a new person
@ -44,6 +34,7 @@ func main() {
app := application.New(application.Options{ app := application.New(application.Options{
Bind: []interface{}{ Bind: []interface{}{
&GreetService{}, &GreetService{},
other.NewOtherService(),
}, },
}) })

View File

@ -0,0 +1,26 @@
package other
// OtherService is a struct
// that does things
type OtherService struct {
t int
}
type Address struct {
Street string
State string
Country string
}
// Yay does this and that
func (o *OtherService) Yay() *Address {
return &Address{
Street: "123 Pitt Street",
State: "New South Wales",
Country: "Australia",
}
}
func NewOtherService() *OtherService {
return &OtherService{}
}

View File

@ -1,15 +0,0 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
export const GreetService = {
/**
* GreetService.Greet
* Greet someone
* @param name {string}
* @returns {Promise<string>}
**/
Greet: function(name) { return wails.CallByID(1411160069, ...Array.prototype.slice.call(arguments, 0)); },
};

View File

@ -0,0 +1,14 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
/**
* Greet someone
* @function Greet
* @param name {string}
* @returns {Promise<string>}
**/
export function Greet(name) {
return wails.CallByID(1411160069, ...Array.prototype.slice.call(arguments, 0));
}

View File

@ -0,0 +1,14 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
/**
* Greet someone
* @function Greet
* @param name {string}
* @returns {Promise<string>}
**/
export function Greet(name) {
return wails.CallByName("main.GreetService.Greet", ...Array.prototype.slice.call(arguments, 0));
}

View File

@ -1,26 +0,0 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
export const GreetService = {
/**
* GreetService.Greet
*
* @param name {string}
* @returns {Promise<string>}
**/
Greet: function(name) { return wails.CallByID(1411160069, ...Array.prototype.slice.call(arguments, 0)); },
};
export const OtherService = {
/**
* OtherService.Hello
*
*
* @returns {Promise<void>}
**/
Hello: function() { return wails.CallByID(4249972365, ...Array.prototype.slice.call(arguments, 0)); },
};

View File

@ -0,0 +1,13 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
/**
* @function Greet
* @param name {string}
* @returns {Promise<string>}
**/
export function Greet(name) {
return wails.CallByID(1411160069, ...Array.prototype.slice.call(arguments, 0));
}

View File

@ -0,0 +1,13 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
/**
* @function Greet
* @param name {string}
* @returns {Promise<string>}
**/
export function Greet(name) {
return wails.CallByName("main.GreetService.Greet", ...Array.prototype.slice.call(arguments, 0));
}

View File

@ -0,0 +1,12 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
/**
* @function Hello
* @returns {Promise<void>}
**/
export function Hello() {
return wails.CallByID(4249972365, ...Array.prototype.slice.call(arguments, 0));
}

View File

@ -0,0 +1,12 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
/**
* @function Hello
* @returns {Promise<void>}
**/
export function Hello() {
return wails.CallByName("main.OtherService.Hello", ...Array.prototype.slice.call(arguments, 0));
}

View File

@ -1,26 +0,0 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
export const GreetService = {
/**
* GreetService.Greet
*
* @param name {string}
* @returns {Promise<string>}
**/
Greet: function(name) { return wails.CallByID(1411160069, ...Array.prototype.slice.call(arguments, 0)); },
};
export const OtherService = {
/**
* OtherService.Hello
*
*
* @returns {Promise<void>}
**/
Hello: function() { return wails.CallByID(4249972365, ...Array.prototype.slice.call(arguments, 0)); },
};

View File

@ -0,0 +1,13 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
/**
* @function Greet
* @param name {string}
* @returns {Promise<string>}
**/
export function Greet(name) {
return wails.CallByID(1411160069, ...Array.prototype.slice.call(arguments, 0));
}

View File

@ -0,0 +1,13 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
/**
* @function Greet
* @param name {string}
* @returns {Promise<string>}
**/
export function Greet(name) {
return wails.CallByName("main.GreetService.Greet", ...Array.prototype.slice.call(arguments, 0));
}

View File

@ -0,0 +1,12 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
/**
* @function Hello
* @returns {Promise<void>}
**/
export function Hello() {
return wails.CallByID(4249972365, ...Array.prototype.slice.call(arguments, 0));
}

View File

@ -0,0 +1,12 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
/**
* @function Hello
* @returns {Promise<void>}
**/
export function Hello() {
return wails.CallByName("main.OtherService.Hello", ...Array.prototype.slice.call(arguments, 0));
}

View File

@ -1,27 +0,0 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
/**
* @typedef {import('./models').main.Person} mainPerson
*/
export const GreetService = {
/**
* GreetService.Greet
* Greet does XYZ
* @param name {string}
* @returns {Promise<string>}
**/
Greet: function(name) { return wails.CallByID(1411160069, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.NewPerson
* NewPerson creates a new person
* @param name {string}
* @returns {Promise<mainPerson>}
**/
NewPerson: function(name) { return wails.CallByID(1661412647, ...Array.prototype.slice.call(arguments, 0)); },
};

View File

@ -1,19 +0,0 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
/**
* @typedef {import('./models').services.Address} servicesAddress
*/
export const OtherService = {
/**
* OtherService.Yay
*
*
* @returns {Promise<servicesAddress>}
**/
Yay: function() { return wails.CallByID(469445984, ...Array.prototype.slice.call(arguments, 0)); },
};

View File

@ -0,0 +1,27 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
/**
* @typedef {import('./models').Person} Person
*/
/**
* Greet does XYZ
* @function Greet
* @param name {string}
* @returns {Promise<string>}
**/
export function Greet(name) {
return wails.CallByID(1411160069, ...Array.prototype.slice.call(arguments, 0));
}
/**
* NewPerson creates a new person
* @function NewPerson
* @param name {string}
* @returns {Promise<Person>}
**/
export function NewPerson(name) {
return wails.CallByID(1661412647, ...Array.prototype.slice.call(arguments, 0));
}

View File

@ -0,0 +1,27 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
/**
* @typedef {import('./models').Person} Person
*/
/**
* Greet does XYZ
* @function Greet
* @param name {string}
* @returns {Promise<string>}
**/
export function Greet(name) {
return wails.CallByName("main.GreetService.Greet", ...Array.prototype.slice.call(arguments, 0));
}
/**
* NewPerson creates a new person
* @function NewPerson
* @param name {string}
* @returns {Promise<Person>}
**/
export function NewPerson(name) {
return wails.CallByName("main.GreetService.NewPerson", ...Array.prototype.slice.call(arguments, 0));
}

View File

@ -0,0 +1,10 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
import * as services from "../services/models";
export interface Person {
name: string;
address: services.Address;
}

View File

@ -0,0 +1,33 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
/**
* @typedef {import('../services/models').Address} servicesAddress
*/
export const Person = class {
/**
* Creates a new Person instance.
* @constructor
* @param {Object} source - The source object to create the Person.
* @param {string} source.Name
* @param {servicesAddress} source.Address
*/
constructor(source = {}) {
const { name = "", address = null } = source;
this.name = name;
this.address = address;
}
/**
* Creates a new Person instance from a string or object.
* @param {string|object} source - The source data to create a Person instance from.
* @returns {Person} A new Person instance.
*/
static createFrom(source) {
let parsedSource = typeof source === 'string' ? JSON.parse(source) : source;
return new Person(parsedSource);
}
};

View File

@ -0,0 +1,21 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
import * as services from "../services/models";
export class Person {
name: string;
address: services.Address;
constructor(source: Partial<Person> = {}) {
const {name = "", address = null} = source;
this.name = name;
this.address = address;
}
static createFrom(source: string | object = {}): Person {
let parsedSource = typeof source === 'string' ? JSON.parse(source) : source;
return new Person(parsedSource as Partial<Person>);
}
}

View File

@ -0,0 +1,16 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
/**
* @typedef {import('./models').Address} Address
*/
/**
* Yay does this and that
* @function Yay
* @returns {Promise<Address>}
**/
export function Yay() {
return wails.CallByID(469445984, ...Array.prototype.slice.call(arguments, 0));
}

View File

@ -0,0 +1,16 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
/**
* @typedef {import('./models').Address} Address
*/
/**
* Yay does this and that
* @function Yay
* @returns {Promise<Address>}
**/
export function Yay() {
return wails.CallByName("services.OtherService.Yay", ...Array.prototype.slice.call(arguments, 0));
}

View File

@ -2,4 +2,9 @@
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT // This file is automatically generated. DO NOT EDIT
// TODO : nothing generated yet
export interface Address {
street: string;
state: string;
country: string;
}

View File

@ -0,0 +1,31 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
export const Address = class {
/**
* Creates a new Address instance.
* @constructor
* @param {Object} source - The source object to create the Address.
* @param {string} source.Street
* @param {string} source.State
* @param {string} source.Country
*/
constructor(source = {}) {
const { street = "", state = "", country = "" } = source;
this.street = street;
this.state = state;
this.country = country;
}
/**
* Creates a new Address instance from a string or object.
* @param {string|object} source - The source data to create a Address instance from.
* @returns {Address} A new Address instance.
*/
static createFrom(source) {
let parsedSource = typeof source === 'string' ? JSON.parse(source) : source;
return new Address(parsedSource);
}
};

View File

@ -0,0 +1,22 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
export class Address {
street: string;
state: string;
country: string;
constructor(source: Partial<Address> = {}) {
const {street = "", state = "", country = ""} = source;
this.street = street;
this.state = state;
this.country = country;
}
static createFrom(source: string | object = {}): Address {
let parsedSource = typeof source === 'string' ? JSON.parse(source) : source;
return new Address(parsedSource as Partial<Address>);
}
}

View File

@ -1,63 +0,0 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
// Defining the main namespace
export const main = {};
main.Person = class {
/**
* Creates a new Person instance.
* @constructor
* @param {Object} source - The source object to create the Person.
* @param {string} source.Name
* @param {services.Address} source.Address
*/
constructor(source = {}) {
const { name = "", address = null } = source;
this.name = name;
this.address = address;
}
/**
* Creates a new Person instance from a string or object.
* @param {string|object} source - The source data to create a Person instance from.
* @returns main.Person A new Person instance.
*/
static createFrom(source = {}) {
let parsedSource = typeof source === 'string' ? JSON.parse(source) : source;
return new main.Person(parsedSource);
}
};
// Defining the services namespace
export const services = {};
services.Address = class {
/**
* Creates a new Address instance.
* @constructor
* @param {Object} source - The source object to create the Address.
* @param {string} source.Street
* @param {string} source.State
* @param {string} source.Country
*/
constructor(source = {}) {
const { street = "", state = "", country = "" } = source;
this.street = street;
this.state = state;
this.country = country;
}
/**
* Creates a new Address instance from a string or object.
* @param {string|object} source - The source data to create a Address instance from.
* @returns services.Address A new Address instance.
*/
static createFrom(source = {}) {
let parsedSource = typeof source === 'string' ? JSON.parse(source) : source;
return new services.Address(parsedSource);
}
};

View File

@ -1,48 +0,0 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
export namespace main {
export class Person {
name: string;
address: services.Address;
constructor(source: Partial<Person> = {}) {
const { name = "", address = null } = source;
this.name = name;
this.address = address;
}
static createFrom(source: string | object = {}): Person {
let parsedSource = typeof source === 'string' ? JSON.parse(source) : source;
return new Person(parsedSource as Partial<Person>);
}
}
}
export namespace services {
export class Address {
street: string;
state: string;
country: string;
constructor(source: Partial<Address> = {}) {
const { street = "", state = "", country = "" } = source;
this.street = street;
this.state = state;
this.country = country;
}
static createFrom(source: string | object = {}): Address {
let parsedSource = typeof source === 'string' ? JSON.parse(source) : source;
return new Address(parsedSource as Partial<Address>);
}
}
}

View File

@ -1,356 +0,0 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
import {main} from './models';
window.go = window.go || {};
window.go.main = {
GreetService: {
/**
* GreetService.ArrayInt
*
* @param _in {number[]}
* @returns {Promise<void>}
**/
ArrayInt: function(_in) { wails.CallByID(3862002418, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.BoolInBoolOut
*
* @param _in {boolean}
* @returns {Promise<boolean>}
**/
BoolInBoolOut: function(_in) { wails.CallByID(2424639793, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.Float32InFloat32Out
*
* @param _in {number}
* @returns {Promise<number>}
**/
Float32InFloat32Out: function(_in) { wails.CallByID(3132595881, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.Float64InFloat64Out
*
* @param _in {number}
* @returns {Promise<number>}
**/
Float64InFloat64Out: function(_in) { wails.CallByID(2182412247, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.Greet
* Greet someone
* @param name {string}
* @returns {Promise<string>}
**/
Greet: function(name) { wails.CallByID(1411160069, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.Int16InIntOut
*
* @param _in {number}
* @returns {Promise<number>}
**/
Int16InIntOut: function(_in) { wails.CallByID(3306292566, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.Int16PointerInAndOutput
*
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
Int16PointerInAndOutput: function(_in) { wails.CallByID(1754277916, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.Int32InIntOut
*
* @param _in {number}
* @returns {Promise<number>}
**/
Int32InIntOut: function(_in) { wails.CallByID(1909469092, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.Int32PointerInAndOutput
*
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
Int32PointerInAndOutput: function(_in) { wails.CallByID(4251088558, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.Int64InIntOut
*
* @param _in {number}
* @returns {Promise<number>}
**/
Int64InIntOut: function(_in) { wails.CallByID(1343888303, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.Int64PointerInAndOutput
*
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
Int64PointerInAndOutput: function(_in) { wails.CallByID(2205561041, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.Int8InIntOut
*
* @param _in {number}
* @returns {Promise<number>}
**/
Int8InIntOut: function(_in) { wails.CallByID(572240879, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.Int8PointerInAndOutput
*
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
Int8PointerInAndOutput: function(_in) { wails.CallByID(2189402897, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.IntInIntOut
*
* @param _in {number}
* @returns {Promise<number>}
**/
IntInIntOut: function(_in) { wails.CallByID(642881729, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.IntPointerInAndOutput
*
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
IntPointerInAndOutput: function(_in) { wails.CallByID(1066151743, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.IntPointerInputNamedOutputs
*
* @param _in {number | null}
* @returns {Promise<number | null, void>}
**/
IntPointerInputNamedOutputs: function(_in) { wails.CallByID(2718999663, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.MapIntInt
*
* @param _in {map}
* @returns {Promise<void>}
**/
MapIntInt: function(_in) { wails.CallByID(2386486356, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.MapIntPointerInt
*
* @param _in {map}
* @returns {Promise<void>}
**/
MapIntPointerInt: function(_in) { wails.CallByID(550413585, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.MapIntSliceInt
*
* @param _in {map}
* @returns {Promise<void>}
**/
MapIntSliceInt: function(_in) { wails.CallByID(2900172572, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.MapIntSliceIntInMapIntSliceIntOut
*
* @param _in {map}
* @returns {Promise<map>}
**/
MapIntSliceIntInMapIntSliceIntOut: function(_in) { wails.CallByID(881980169, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.NoInputsStringOut
*
*
* @returns {Promise<string>}
**/
NoInputsStringOut: function() { wails.CallByID(1075577233, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.PointerBoolInBoolOut
*
* @param _in {boolean | null}
* @returns {Promise<boolean | null>}
**/
PointerBoolInBoolOut: function(_in) { wails.CallByID(3589606958, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.PointerFloat32InFloat32Out
*
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
PointerFloat32InFloat32Out: function(_in) { wails.CallByID(224675106, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.PointerFloat64InFloat64Out
*
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
PointerFloat64InFloat64Out: function(_in) { wails.CallByID(2124953624, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.PointerMapIntInt
*
* @param _in {map | null}
* @returns {Promise<void>}
**/
PointerMapIntInt: function(_in) { wails.CallByID(3516977899, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.PointerStringInStringOut
*
* @param _in {string | null}
* @returns {Promise<string | null>}
**/
PointerStringInStringOut: function(_in) { wails.CallByID(229603958, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.StringArrayInputNamedOutput
*
* @param _in {string[]}
* @returns {Promise<string[]>}
**/
StringArrayInputNamedOutput: function(_in) { wails.CallByID(3678582682, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.StringArrayInputNamedOutputs
*
* @param _in {string[]}
* @returns {Promise<string[], void>}
**/
StringArrayInputNamedOutputs: function(_in) { wails.CallByID(319259595, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.StringArrayInputStringArrayOut
*
* @param _in {string[]}
* @returns {Promise<string[]>}
**/
StringArrayInputStringArrayOut: function(_in) { wails.CallByID(383995060, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.StringArrayInputStringOut
*
* @param _in {string[]}
* @returns {Promise<string>}
**/
StringArrayInputStringOut: function(_in) { wails.CallByID(1091960237, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.StructInputStructOutput
*
* @param _in {main.Person}
* @returns {Promise<main.Person>}
**/
StructInputStructOutput: function(_in) { wails.CallByID(3835643147, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.StructPointerInputErrorOutput
*
* @param _in {main.Person | null}
* @returns {Promise<void>}
**/
StructPointerInputErrorOutput: function(_in) { wails.CallByID(2447692557, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.StructPointerInputStructPointerOutput
*
* @param _in {main.Person | null}
* @returns {Promise<main.Person | null>}
**/
StructPointerInputStructPointerOutput: function(_in) { wails.CallByID(2943477349, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.UInt16InUIntOut
*
* @param _in {number}
* @returns {Promise<number>}
**/
UInt16InUIntOut: function(_in) { wails.CallByID(3401034892, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.UInt16PointerInAndOutput
*
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
UInt16PointerInAndOutput: function(_in) { wails.CallByID(1236957573, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.UInt32InUIntOut
*
* @param _in {number}
* @returns {Promise<number>}
**/
UInt32InUIntOut: function(_in) { wails.CallByID(1160383782, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.UInt32PointerInAndOutput
*
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
UInt32PointerInAndOutput: function(_in) { wails.CallByID(1739300671, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.UInt64InUIntOut
*
* @param _in {number}
* @returns {Promise<number>}
**/
UInt64InUIntOut: function(_in) { wails.CallByID(793803239, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.UInt64PointerInAndOutput
*
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
UInt64PointerInAndOutput: function(_in) { wails.CallByID(1403757716, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.UInt8InUIntOut
*
* @param _in {number}
* @returns {Promise<number>}
**/
UInt8InUIntOut: function(_in) { wails.CallByID(2988345717, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.UInt8PointerInAndOutput
*
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
UInt8PointerInAndOutput: function(_in) { wails.CallByID(518250834, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.UIntInUIntOut
*
* @param _in {number}
* @returns {Promise<number>}
**/
UIntInUIntOut: function(_in) { wails.CallByID(2836661285, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.UIntPointerInAndOutput
*
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
UIntPointerInAndOutput: function(_in) { wails.CallByID(1367187362, ...Array.prototype.slice.call(arguments, 0)); },
},
};

View File

@ -0,0 +1,394 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
/**
* @typedef {import('./models').Person} Person
*/
/**
* @function ArrayInt
* @param _in {number[]}
* @returns {Promise<void>}
**/
export function ArrayInt(_in) {
return wails.CallByID(3862002418, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function BoolInBoolOut
* @param _in {boolean}
* @returns {Promise<boolean>}
**/
export function BoolInBoolOut(_in) {
return wails.CallByID(2424639793, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function Float32InFloat32Out
* @param _in {number}
* @returns {Promise<number>}
**/
export function Float32InFloat32Out(_in) {
return wails.CallByID(3132595881, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function Float64InFloat64Out
* @param _in {number}
* @returns {Promise<number>}
**/
export function Float64InFloat64Out(_in) {
return wails.CallByID(2182412247, ...Array.prototype.slice.call(arguments, 0));
}
/**
* Greet someone
* @function Greet
* @param name {string}
* @returns {Promise<string>}
**/
export function Greet(name) {
return wails.CallByID(1411160069, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function Int16InIntOut
* @param _in {number}
* @returns {Promise<number>}
**/
export function Int16InIntOut(_in) {
return wails.CallByID(3306292566, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function Int16PointerInAndOutput
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
export function Int16PointerInAndOutput(_in) {
return wails.CallByID(1754277916, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function Int32InIntOut
* @param _in {number}
* @returns {Promise<number>}
**/
export function Int32InIntOut(_in) {
return wails.CallByID(1909469092, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function Int32PointerInAndOutput
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
export function Int32PointerInAndOutput(_in) {
return wails.CallByID(4251088558, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function Int64InIntOut
* @param _in {number}
* @returns {Promise<number>}
**/
export function Int64InIntOut(_in) {
return wails.CallByID(1343888303, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function Int64PointerInAndOutput
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
export function Int64PointerInAndOutput(_in) {
return wails.CallByID(2205561041, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function Int8InIntOut
* @param _in {number}
* @returns {Promise<number>}
**/
export function Int8InIntOut(_in) {
return wails.CallByID(572240879, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function Int8PointerInAndOutput
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
export function Int8PointerInAndOutput(_in) {
return wails.CallByID(2189402897, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function IntInIntOut
* @param _in {number}
* @returns {Promise<number>}
**/
export function IntInIntOut(_in) {
return wails.CallByID(642881729, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function IntPointerInAndOutput
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
export function IntPointerInAndOutput(_in) {
return wails.CallByID(1066151743, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function IntPointerInputNamedOutputs
* @param _in {number | null}
* @returns {Promise<number | null, void>}
**/
export function IntPointerInputNamedOutputs(_in) {
return wails.CallByID(2718999663, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function MapIntInt
* @param _in {map}
* @returns {Promise<void>}
**/
export function MapIntInt(_in) {
return wails.CallByID(2386486356, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function MapIntPointerInt
* @param _in {map}
* @returns {Promise<void>}
**/
export function MapIntPointerInt(_in) {
return wails.CallByID(550413585, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function MapIntSliceInt
* @param _in {map}
* @returns {Promise<void>}
**/
export function MapIntSliceInt(_in) {
return wails.CallByID(2900172572, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function MapIntSliceIntInMapIntSliceIntOut
* @param _in {map}
* @returns {Promise<map>}
**/
export function MapIntSliceIntInMapIntSliceIntOut(_in) {
return wails.CallByID(881980169, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function NoInputsStringOut
* @returns {Promise<string>}
**/
export function NoInputsStringOut() {
return wails.CallByID(1075577233, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function PointerBoolInBoolOut
* @param _in {boolean | null}
* @returns {Promise<boolean | null>}
**/
export function PointerBoolInBoolOut(_in) {
return wails.CallByID(3589606958, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function PointerFloat32InFloat32Out
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
export function PointerFloat32InFloat32Out(_in) {
return wails.CallByID(224675106, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function PointerFloat64InFloat64Out
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
export function PointerFloat64InFloat64Out(_in) {
return wails.CallByID(2124953624, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function PointerMapIntInt
* @param _in {map | null}
* @returns {Promise<void>}
**/
export function PointerMapIntInt(_in) {
return wails.CallByID(3516977899, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function PointerStringInStringOut
* @param _in {string | null}
* @returns {Promise<string | null>}
**/
export function PointerStringInStringOut(_in) {
return wails.CallByID(229603958, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function StringArrayInputNamedOutput
* @param _in {string[]}
* @returns {Promise<string[]>}
**/
export function StringArrayInputNamedOutput(_in) {
return wails.CallByID(3678582682, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function StringArrayInputNamedOutputs
* @param _in {string[]}
* @returns {Promise<string[], void>}
**/
export function StringArrayInputNamedOutputs(_in) {
return wails.CallByID(319259595, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function StringArrayInputStringArrayOut
* @param _in {string[]}
* @returns {Promise<string[]>}
**/
export function StringArrayInputStringArrayOut(_in) {
return wails.CallByID(383995060, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function StringArrayInputStringOut
* @param _in {string[]}
* @returns {Promise<string>}
**/
export function StringArrayInputStringOut(_in) {
return wails.CallByID(1091960237, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function StructInputStructOutput
* @param _in {Person}
* @returns {Promise<Person>}
**/
export function StructInputStructOutput(_in) {
return wails.CallByID(3835643147, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function StructPointerInputErrorOutput
* @param _in {Person | null}
* @returns {Promise<void>}
**/
export function StructPointerInputErrorOutput(_in) {
return wails.CallByID(2447692557, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function StructPointerInputStructPointerOutput
* @param _in {Person | null}
* @returns {Promise<Person>}
**/
export function StructPointerInputStructPointerOutput(_in) {
return wails.CallByID(2943477349, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function UInt16InUIntOut
* @param _in {number}
* @returns {Promise<number>}
**/
export function UInt16InUIntOut(_in) {
return wails.CallByID(3401034892, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function UInt16PointerInAndOutput
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
export function UInt16PointerInAndOutput(_in) {
return wails.CallByID(1236957573, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function UInt32InUIntOut
* @param _in {number}
* @returns {Promise<number>}
**/
export function UInt32InUIntOut(_in) {
return wails.CallByID(1160383782, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function UInt32PointerInAndOutput
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
export function UInt32PointerInAndOutput(_in) {
return wails.CallByID(1739300671, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function UInt64InUIntOut
* @param _in {number}
* @returns {Promise<number>}
**/
export function UInt64InUIntOut(_in) {
return wails.CallByID(793803239, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function UInt64PointerInAndOutput
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
export function UInt64PointerInAndOutput(_in) {
return wails.CallByID(1403757716, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function UInt8InUIntOut
* @param _in {number}
* @returns {Promise<number>}
**/
export function UInt8InUIntOut(_in) {
return wails.CallByID(2988345717, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function UInt8PointerInAndOutput
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
export function UInt8PointerInAndOutput(_in) {
return wails.CallByID(518250834, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function UIntInUIntOut
* @param _in {number}
* @returns {Promise<number>}
**/
export function UIntInUIntOut(_in) {
return wails.CallByID(2836661285, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function UIntPointerInAndOutput
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
export function UIntPointerInAndOutput(_in) {
return wails.CallByID(1367187362, ...Array.prototype.slice.call(arguments, 0));
}

View File

@ -0,0 +1,394 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
/**
* @typedef {import('./models').Person} Person
*/
/**
* @function ArrayInt
* @param _in {number[]}
* @returns {Promise<void>}
**/
export function ArrayInt(_in) {
return wails.CallByName("main.GreetService.ArrayInt", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function BoolInBoolOut
* @param _in {boolean}
* @returns {Promise<boolean>}
**/
export function BoolInBoolOut(_in) {
return wails.CallByName("main.GreetService.BoolInBoolOut", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function Float32InFloat32Out
* @param _in {number}
* @returns {Promise<number>}
**/
export function Float32InFloat32Out(_in) {
return wails.CallByName("main.GreetService.Float32InFloat32Out", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function Float64InFloat64Out
* @param _in {number}
* @returns {Promise<number>}
**/
export function Float64InFloat64Out(_in) {
return wails.CallByName("main.GreetService.Float64InFloat64Out", ...Array.prototype.slice.call(arguments, 0));
}
/**
* Greet someone
* @function Greet
* @param name {string}
* @returns {Promise<string>}
**/
export function Greet(name) {
return wails.CallByName("main.GreetService.Greet", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function Int16InIntOut
* @param _in {number}
* @returns {Promise<number>}
**/
export function Int16InIntOut(_in) {
return wails.CallByName("main.GreetService.Int16InIntOut", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function Int16PointerInAndOutput
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
export function Int16PointerInAndOutput(_in) {
return wails.CallByName("main.GreetService.Int16PointerInAndOutput", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function Int32InIntOut
* @param _in {number}
* @returns {Promise<number>}
**/
export function Int32InIntOut(_in) {
return wails.CallByName("main.GreetService.Int32InIntOut", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function Int32PointerInAndOutput
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
export function Int32PointerInAndOutput(_in) {
return wails.CallByName("main.GreetService.Int32PointerInAndOutput", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function Int64InIntOut
* @param _in {number}
* @returns {Promise<number>}
**/
export function Int64InIntOut(_in) {
return wails.CallByName("main.GreetService.Int64InIntOut", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function Int64PointerInAndOutput
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
export function Int64PointerInAndOutput(_in) {
return wails.CallByName("main.GreetService.Int64PointerInAndOutput", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function Int8InIntOut
* @param _in {number}
* @returns {Promise<number>}
**/
export function Int8InIntOut(_in) {
return wails.CallByName("main.GreetService.Int8InIntOut", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function Int8PointerInAndOutput
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
export function Int8PointerInAndOutput(_in) {
return wails.CallByName("main.GreetService.Int8PointerInAndOutput", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function IntInIntOut
* @param _in {number}
* @returns {Promise<number>}
**/
export function IntInIntOut(_in) {
return wails.CallByName("main.GreetService.IntInIntOut", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function IntPointerInAndOutput
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
export function IntPointerInAndOutput(_in) {
return wails.CallByName("main.GreetService.IntPointerInAndOutput", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function IntPointerInputNamedOutputs
* @param _in {number | null}
* @returns {Promise<number | null, void>}
**/
export function IntPointerInputNamedOutputs(_in) {
return wails.CallByName("main.GreetService.IntPointerInputNamedOutputs", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function MapIntInt
* @param _in {map}
* @returns {Promise<void>}
**/
export function MapIntInt(_in) {
return wails.CallByName("main.GreetService.MapIntInt", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function MapIntPointerInt
* @param _in {map}
* @returns {Promise<void>}
**/
export function MapIntPointerInt(_in) {
return wails.CallByName("main.GreetService.MapIntPointerInt", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function MapIntSliceInt
* @param _in {map}
* @returns {Promise<void>}
**/
export function MapIntSliceInt(_in) {
return wails.CallByName("main.GreetService.MapIntSliceInt", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function MapIntSliceIntInMapIntSliceIntOut
* @param _in {map}
* @returns {Promise<map>}
**/
export function MapIntSliceIntInMapIntSliceIntOut(_in) {
return wails.CallByName("main.GreetService.MapIntSliceIntInMapIntSliceIntOut", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function NoInputsStringOut
* @returns {Promise<string>}
**/
export function NoInputsStringOut() {
return wails.CallByName("main.GreetService.NoInputsStringOut", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function PointerBoolInBoolOut
* @param _in {boolean | null}
* @returns {Promise<boolean | null>}
**/
export function PointerBoolInBoolOut(_in) {
return wails.CallByName("main.GreetService.PointerBoolInBoolOut", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function PointerFloat32InFloat32Out
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
export function PointerFloat32InFloat32Out(_in) {
return wails.CallByName("main.GreetService.PointerFloat32InFloat32Out", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function PointerFloat64InFloat64Out
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
export function PointerFloat64InFloat64Out(_in) {
return wails.CallByName("main.GreetService.PointerFloat64InFloat64Out", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function PointerMapIntInt
* @param _in {map | null}
* @returns {Promise<void>}
**/
export function PointerMapIntInt(_in) {
return wails.CallByName("main.GreetService.PointerMapIntInt", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function PointerStringInStringOut
* @param _in {string | null}
* @returns {Promise<string | null>}
**/
export function PointerStringInStringOut(_in) {
return wails.CallByName("main.GreetService.PointerStringInStringOut", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function StringArrayInputNamedOutput
* @param _in {string[]}
* @returns {Promise<string[]>}
**/
export function StringArrayInputNamedOutput(_in) {
return wails.CallByName("main.GreetService.StringArrayInputNamedOutput", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function StringArrayInputNamedOutputs
* @param _in {string[]}
* @returns {Promise<string[], void>}
**/
export function StringArrayInputNamedOutputs(_in) {
return wails.CallByName("main.GreetService.StringArrayInputNamedOutputs", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function StringArrayInputStringArrayOut
* @param _in {string[]}
* @returns {Promise<string[]>}
**/
export function StringArrayInputStringArrayOut(_in) {
return wails.CallByName("main.GreetService.StringArrayInputStringArrayOut", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function StringArrayInputStringOut
* @param _in {string[]}
* @returns {Promise<string>}
**/
export function StringArrayInputStringOut(_in) {
return wails.CallByName("main.GreetService.StringArrayInputStringOut", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function StructInputStructOutput
* @param _in {Person}
* @returns {Promise<Person>}
**/
export function StructInputStructOutput(_in) {
return wails.CallByName("main.GreetService.StructInputStructOutput", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function StructPointerInputErrorOutput
* @param _in {Person | null}
* @returns {Promise<void>}
**/
export function StructPointerInputErrorOutput(_in) {
return wails.CallByName("main.GreetService.StructPointerInputErrorOutput", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function StructPointerInputStructPointerOutput
* @param _in {Person | null}
* @returns {Promise<Person>}
**/
export function StructPointerInputStructPointerOutput(_in) {
return wails.CallByName("main.GreetService.StructPointerInputStructPointerOutput", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function UInt16InUIntOut
* @param _in {number}
* @returns {Promise<number>}
**/
export function UInt16InUIntOut(_in) {
return wails.CallByName("main.GreetService.UInt16InUIntOut", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function UInt16PointerInAndOutput
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
export function UInt16PointerInAndOutput(_in) {
return wails.CallByName("main.GreetService.UInt16PointerInAndOutput", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function UInt32InUIntOut
* @param _in {number}
* @returns {Promise<number>}
**/
export function UInt32InUIntOut(_in) {
return wails.CallByName("main.GreetService.UInt32InUIntOut", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function UInt32PointerInAndOutput
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
export function UInt32PointerInAndOutput(_in) {
return wails.CallByName("main.GreetService.UInt32PointerInAndOutput", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function UInt64InUIntOut
* @param _in {number}
* @returns {Promise<number>}
**/
export function UInt64InUIntOut(_in) {
return wails.CallByName("main.GreetService.UInt64InUIntOut", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function UInt64PointerInAndOutput
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
export function UInt64PointerInAndOutput(_in) {
return wails.CallByName("main.GreetService.UInt64PointerInAndOutput", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function UInt8InUIntOut
* @param _in {number}
* @returns {Promise<number>}
**/
export function UInt8InUIntOut(_in) {
return wails.CallByName("main.GreetService.UInt8InUIntOut", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function UInt8PointerInAndOutput
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
export function UInt8PointerInAndOutput(_in) {
return wails.CallByName("main.GreetService.UInt8PointerInAndOutput", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function UIntInUIntOut
* @param _in {number}
* @returns {Promise<number>}
**/
export function UIntInUIntOut(_in) {
return wails.CallByName("main.GreetService.UIntInUIntOut", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function UIntPointerInAndOutput
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
export function UIntPointerInAndOutput(_in) {
return wails.CallByName("main.GreetService.UIntPointerInAndOutput", ...Array.prototype.slice.call(arguments, 0));
}

View File

@ -0,0 +1,19 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
export interface Person {
name: string;
parent: Person;
details: anon1;
}
export interface anon1 {
age: number;
address: anon2;
}
export interface anon2 {
street: string;
}

View File

@ -2,17 +2,14 @@
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT // This file is automatically generated. DO NOT EDIT
// Defining the main namespace export const Person = class {
export const main = {};
main.Person = class {
/** /**
* Creates a new Person instance. * Creates a new Person instance.
* @constructor * @constructor
* @param {Object} source - The source object to create the Person. * @param {Object} source - The source object to create the Person.
* @param {string} source.Name * @param {string} source.Name
* @param {main.Person} source.Parent * @param {Person} source.Parent
* @param {main.anon1} source.Details * @param {anon1} source.Details
*/ */
constructor(source = {}) { constructor(source = {}) {
const { name = "", parent = null, details = null } = source; const { name = "", parent = null, details = null } = source;
@ -24,20 +21,21 @@ main.Person = class {
/** /**
* Creates a new Person instance from a string or object. * Creates a new Person instance from a string or object.
* @param {string|object} source - The source data to create a Person instance from. * @param {string|object} source - The source data to create a Person instance from.
* @returns main.Person A new Person instance. * @returns {Person} A new Person instance.
*/ */
static createFrom(source = {}) { static createFrom(source) {
let parsedSource = typeof source === 'string' ? JSON.parse(source) : source; let parsedSource = typeof source === 'string' ? JSON.parse(source) : source;
return new main.Person(parsedSource); return new Person(parsedSource);
} }
}; };
main.anon1 = class {
export const anon1 = class {
/** /**
* Creates a new anon1 instance. * Creates a new anon1 instance.
* @constructor * @constructor
* @param {Object} source - The source object to create the anon1. * @param {Object} source - The source object to create the anon1.
* @param {number} source.Age * @param {number} source.Age
* @param {main.anon2} source.Address * @param {anon2} source.Address
*/ */
constructor(source = {}) { constructor(source = {}) {
const { age = 0, address = null } = source; const { age = 0, address = null } = source;
@ -48,14 +46,15 @@ main.anon1 = class {
/** /**
* Creates a new anon1 instance from a string or object. * Creates a new anon1 instance from a string or object.
* @param {string|object} source - The source data to create a anon1 instance from. * @param {string|object} source - The source data to create a anon1 instance from.
* @returns main.anon1 A new anon1 instance. * @returns {anon1} A new anon1 instance.
*/ */
static createFrom(source = {}) { static createFrom(source) {
let parsedSource = typeof source === 'string' ? JSON.parse(source) : source; let parsedSource = typeof source === 'string' ? JSON.parse(source) : source;
return new main.anon1(parsedSource); return new anon1(parsedSource);
} }
}; };
main.anon2 = class {
export const anon2 = class {
/** /**
* Creates a new anon2 instance. * Creates a new anon2 instance.
* @constructor * @constructor
@ -70,11 +69,11 @@ main.anon2 = class {
/** /**
* Creates a new anon2 instance from a string or object. * Creates a new anon2 instance from a string or object.
* @param {string|object} source - The source data to create a anon2 instance from. * @param {string|object} source - The source data to create a anon2 instance from.
* @returns main.anon2 A new anon2 instance. * @returns {anon2} A new anon2 instance.
*/ */
static createFrom(source = {}) { static createFrom(source) {
let parsedSource = typeof source === 'string' ? JSON.parse(source) : source; let parsedSource = typeof source === 'string' ? JSON.parse(source) : source;
return new main.anon2(parsedSource); return new anon2(parsedSource);
} }
}; };

View File

@ -0,0 +1,52 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
export class Person {
name: string;
parent: Person;
details: anon1;
constructor(source: Partial<Person> = {}) {
const {name = "", parent = null, details = null} = source;
this.name = name;
this.parent = parent;
this.details = details;
}
static createFrom(source: string | object = {}): Person {
let parsedSource = typeof source === 'string' ? JSON.parse(source) : source;
return new Person(parsedSource as Partial<Person>);
}
}
export class anon1 {
age: number;
address: anon2;
constructor(source: Partial<anon1> = {}) {
const {age = 0, address = null} = source;
this.age = age;
this.address = address;
}
static createFrom(source: string | object = {}): anon1 {
let parsedSource = typeof source === 'string' ? JSON.parse(source) : source;
return new anon1(parsedSource as Partial<anon1>);
}
}
export class anon2 {
street: string;
constructor(source: Partial<anon2> = {}) {
const {street = ""} = source;
this.street = street;
}
static createFrom(source: string | object = {}): anon2 {
let parsedSource = typeof source === 'string' ? JSON.parse(source) : source;
return new anon2(parsedSource as Partial<anon2>);
}
}

View File

@ -1,59 +0,0 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
export namespace main {
export class Person {
name: string;
parent: Person;
details: anon1;
constructor(source: Partial<Person> = {}) {
const { name = "", parent = null, details = null } = source;
this.name = name;
this.parent = parent;
this.details = details;
}
static createFrom(source: string | object = {}): Person {
let parsedSource = typeof source === 'string' ? JSON.parse(source) : source;
return new Person(parsedSource as Partial<Person>);
}
}
export class anon1 {
age: number;
address: anon2;
constructor(source: Partial<anon1> = {}) {
const { age = 0, address = null } = source;
this.age = age;
this.address = address;
}
static createFrom(source: string | object = {}): anon1 {
let parsedSource = typeof source === 'string' ? JSON.parse(source) : source;
return new anon1(parsedSource as Partial<anon1>);
}
}
export class anon2 {
street: string;
constructor(source: Partial<anon2> = {}) {
const { street = "" } = source;
this.street = street;
}
static createFrom(source: string | object = {}): anon2 {
let parsedSource = typeof source === 'string' ? JSON.parse(source) : source;
return new anon2(parsedSource as Partial<anon2>);
}
}
}

View File

@ -1,355 +0,0 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
/**
* @typedef {import('./models').main.Person} mainPerson
*/
export const GreetService = {
/**
* GreetService.ArrayInt
*
* @param _in {number[]}
* @returns {Promise<void>}
**/
ArrayInt: function(_in) { return wails.CallByID(3862002418, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.BoolInBoolOut
*
* @param _in {boolean}
* @returns {Promise<boolean>}
**/
BoolInBoolOut: function(_in) { return wails.CallByID(2424639793, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.Float32InFloat32Out
*
* @param _in {number}
* @returns {Promise<number>}
**/
Float32InFloat32Out: function(_in) { return wails.CallByID(3132595881, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.Float64InFloat64Out
*
* @param _in {number}
* @returns {Promise<number>}
**/
Float64InFloat64Out: function(_in) { return wails.CallByID(2182412247, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.Greet
* Greet someone
* @param name {string}
* @returns {Promise<string>}
**/
Greet: function(name) { return wails.CallByID(1411160069, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.Int16InIntOut
*
* @param _in {number}
* @returns {Promise<number>}
**/
Int16InIntOut: function(_in) { return wails.CallByID(3306292566, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.Int16PointerInAndOutput
*
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
Int16PointerInAndOutput: function(_in) { return wails.CallByID(1754277916, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.Int32InIntOut
*
* @param _in {number}
* @returns {Promise<number>}
**/
Int32InIntOut: function(_in) { return wails.CallByID(1909469092, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.Int32PointerInAndOutput
*
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
Int32PointerInAndOutput: function(_in) { return wails.CallByID(4251088558, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.Int64InIntOut
*
* @param _in {number}
* @returns {Promise<number>}
**/
Int64InIntOut: function(_in) { return wails.CallByID(1343888303, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.Int64PointerInAndOutput
*
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
Int64PointerInAndOutput: function(_in) { return wails.CallByID(2205561041, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.Int8InIntOut
*
* @param _in {number}
* @returns {Promise<number>}
**/
Int8InIntOut: function(_in) { return wails.CallByID(572240879, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.Int8PointerInAndOutput
*
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
Int8PointerInAndOutput: function(_in) { return wails.CallByID(2189402897, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.IntInIntOut
*
* @param _in {number}
* @returns {Promise<number>}
**/
IntInIntOut: function(_in) { return wails.CallByID(642881729, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.IntPointerInAndOutput
*
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
IntPointerInAndOutput: function(_in) { return wails.CallByID(1066151743, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.IntPointerInputNamedOutputs
*
* @param _in {number | null}
* @returns {Promise<number | null, void>}
**/
IntPointerInputNamedOutputs: function(_in) { return wails.CallByID(2718999663, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.MapIntInt
*
* @param _in {map}
* @returns {Promise<void>}
**/
MapIntInt: function(_in) { return wails.CallByID(2386486356, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.MapIntPointerInt
*
* @param _in {map}
* @returns {Promise<void>}
**/
MapIntPointerInt: function(_in) { return wails.CallByID(550413585, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.MapIntSliceInt
*
* @param _in {map}
* @returns {Promise<void>}
**/
MapIntSliceInt: function(_in) { return wails.CallByID(2900172572, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.MapIntSliceIntInMapIntSliceIntOut
*
* @param _in {map}
* @returns {Promise<map>}
**/
MapIntSliceIntInMapIntSliceIntOut: function(_in) { return wails.CallByID(881980169, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.NoInputsStringOut
*
*
* @returns {Promise<string>}
**/
NoInputsStringOut: function() { return wails.CallByID(1075577233, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.PointerBoolInBoolOut
*
* @param _in {boolean | null}
* @returns {Promise<boolean | null>}
**/
PointerBoolInBoolOut: function(_in) { return wails.CallByID(3589606958, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.PointerFloat32InFloat32Out
*
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
PointerFloat32InFloat32Out: function(_in) { return wails.CallByID(224675106, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.PointerFloat64InFloat64Out
*
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
PointerFloat64InFloat64Out: function(_in) { return wails.CallByID(2124953624, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.PointerMapIntInt
*
* @param _in {map | null}
* @returns {Promise<void>}
**/
PointerMapIntInt: function(_in) { return wails.CallByID(3516977899, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.PointerStringInStringOut
*
* @param _in {string | null}
* @returns {Promise<string | null>}
**/
PointerStringInStringOut: function(_in) { return wails.CallByID(229603958, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.StringArrayInputNamedOutput
*
* @param _in {string[]}
* @returns {Promise<string[]>}
**/
StringArrayInputNamedOutput: function(_in) { return wails.CallByID(3678582682, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.StringArrayInputNamedOutputs
*
* @param _in {string[]}
* @returns {Promise<string[], void>}
**/
StringArrayInputNamedOutputs: function(_in) { return wails.CallByID(319259595, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.StringArrayInputStringArrayOut
*
* @param _in {string[]}
* @returns {Promise<string[]>}
**/
StringArrayInputStringArrayOut: function(_in) { return wails.CallByID(383995060, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.StringArrayInputStringOut
*
* @param _in {string[]}
* @returns {Promise<string>}
**/
StringArrayInputStringOut: function(_in) { return wails.CallByID(1091960237, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.StructInputStructOutput
*
* @param _in {mainPerson}
* @returns {Promise<mainPerson>}
**/
StructInputStructOutput: function(_in) { return wails.CallByID(3835643147, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.StructPointerInputErrorOutput
*
* @param _in {mainPerson | null}
* @returns {Promise<void>}
**/
StructPointerInputErrorOutput: function(_in) { return wails.CallByID(2447692557, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.StructPointerInputStructPointerOutput
*
* @param _in {mainPerson | null}
* @returns {Promise<mainPerson>}
**/
StructPointerInputStructPointerOutput: function(_in) { return wails.CallByID(2943477349, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.UInt16InUIntOut
*
* @param _in {number}
* @returns {Promise<number>}
**/
UInt16InUIntOut: function(_in) { return wails.CallByID(3401034892, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.UInt16PointerInAndOutput
*
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
UInt16PointerInAndOutput: function(_in) { return wails.CallByID(1236957573, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.UInt32InUIntOut
*
* @param _in {number}
* @returns {Promise<number>}
**/
UInt32InUIntOut: function(_in) { return wails.CallByID(1160383782, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.UInt32PointerInAndOutput
*
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
UInt32PointerInAndOutput: function(_in) { return wails.CallByID(1739300671, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.UInt64InUIntOut
*
* @param _in {number}
* @returns {Promise<number>}
**/
UInt64InUIntOut: function(_in) { return wails.CallByID(793803239, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.UInt64PointerInAndOutput
*
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
UInt64PointerInAndOutput: function(_in) { return wails.CallByID(1403757716, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.UInt8InUIntOut
*
* @param _in {number}
* @returns {Promise<number>}
**/
UInt8InUIntOut: function(_in) { return wails.CallByID(2988345717, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.UInt8PointerInAndOutput
*
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
UInt8PointerInAndOutput: function(_in) { return wails.CallByID(518250834, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.UIntInUIntOut
*
* @param _in {number}
* @returns {Promise<number>}
**/
UIntInUIntOut: function(_in) { return wails.CallByID(2836661285, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.UIntPointerInAndOutput
*
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
UIntPointerInAndOutput: function(_in) { return wails.CallByID(1367187362, ...Array.prototype.slice.call(arguments, 0)); },
};

View File

@ -0,0 +1,394 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
/**
* @typedef {import('./models').Person} Person
*/
/**
* @function ArrayInt
* @param _in {number[]}
* @returns {Promise<void>}
**/
export function ArrayInt(_in) {
return wails.CallByID(3862002418, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function BoolInBoolOut
* @param _in {boolean}
* @returns {Promise<boolean>}
**/
export function BoolInBoolOut(_in) {
return wails.CallByID(2424639793, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function Float32InFloat32Out
* @param _in {number}
* @returns {Promise<number>}
**/
export function Float32InFloat32Out(_in) {
return wails.CallByID(3132595881, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function Float64InFloat64Out
* @param _in {number}
* @returns {Promise<number>}
**/
export function Float64InFloat64Out(_in) {
return wails.CallByID(2182412247, ...Array.prototype.slice.call(arguments, 0));
}
/**
* Greet someone
* @function Greet
* @param name {string}
* @returns {Promise<string>}
**/
export function Greet(name) {
return wails.CallByID(1411160069, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function Int16InIntOut
* @param _in {number}
* @returns {Promise<number>}
**/
export function Int16InIntOut(_in) {
return wails.CallByID(3306292566, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function Int16PointerInAndOutput
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
export function Int16PointerInAndOutput(_in) {
return wails.CallByID(1754277916, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function Int32InIntOut
* @param _in {number}
* @returns {Promise<number>}
**/
export function Int32InIntOut(_in) {
return wails.CallByID(1909469092, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function Int32PointerInAndOutput
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
export function Int32PointerInAndOutput(_in) {
return wails.CallByID(4251088558, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function Int64InIntOut
* @param _in {number}
* @returns {Promise<number>}
**/
export function Int64InIntOut(_in) {
return wails.CallByID(1343888303, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function Int64PointerInAndOutput
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
export function Int64PointerInAndOutput(_in) {
return wails.CallByID(2205561041, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function Int8InIntOut
* @param _in {number}
* @returns {Promise<number>}
**/
export function Int8InIntOut(_in) {
return wails.CallByID(572240879, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function Int8PointerInAndOutput
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
export function Int8PointerInAndOutput(_in) {
return wails.CallByID(2189402897, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function IntInIntOut
* @param _in {number}
* @returns {Promise<number>}
**/
export function IntInIntOut(_in) {
return wails.CallByID(642881729, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function IntPointerInAndOutput
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
export function IntPointerInAndOutput(_in) {
return wails.CallByID(1066151743, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function IntPointerInputNamedOutputs
* @param _in {number | null}
* @returns {Promise<number | null, void>}
**/
export function IntPointerInputNamedOutputs(_in) {
return wails.CallByID(2718999663, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function MapIntInt
* @param _in {map}
* @returns {Promise<void>}
**/
export function MapIntInt(_in) {
return wails.CallByID(2386486356, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function MapIntPointerInt
* @param _in {map}
* @returns {Promise<void>}
**/
export function MapIntPointerInt(_in) {
return wails.CallByID(550413585, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function MapIntSliceInt
* @param _in {map}
* @returns {Promise<void>}
**/
export function MapIntSliceInt(_in) {
return wails.CallByID(2900172572, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function MapIntSliceIntInMapIntSliceIntOut
* @param _in {map}
* @returns {Promise<map>}
**/
export function MapIntSliceIntInMapIntSliceIntOut(_in) {
return wails.CallByID(881980169, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function NoInputsStringOut
* @returns {Promise<string>}
**/
export function NoInputsStringOut() {
return wails.CallByID(1075577233, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function PointerBoolInBoolOut
* @param _in {boolean | null}
* @returns {Promise<boolean | null>}
**/
export function PointerBoolInBoolOut(_in) {
return wails.CallByID(3589606958, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function PointerFloat32InFloat32Out
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
export function PointerFloat32InFloat32Out(_in) {
return wails.CallByID(224675106, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function PointerFloat64InFloat64Out
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
export function PointerFloat64InFloat64Out(_in) {
return wails.CallByID(2124953624, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function PointerMapIntInt
* @param _in {map | null}
* @returns {Promise<void>}
**/
export function PointerMapIntInt(_in) {
return wails.CallByID(3516977899, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function PointerStringInStringOut
* @param _in {string | null}
* @returns {Promise<string | null>}
**/
export function PointerStringInStringOut(_in) {
return wails.CallByID(229603958, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function StringArrayInputNamedOutput
* @param _in {string[]}
* @returns {Promise<string[]>}
**/
export function StringArrayInputNamedOutput(_in) {
return wails.CallByID(3678582682, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function StringArrayInputNamedOutputs
* @param _in {string[]}
* @returns {Promise<string[], void>}
**/
export function StringArrayInputNamedOutputs(_in) {
return wails.CallByID(319259595, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function StringArrayInputStringArrayOut
* @param _in {string[]}
* @returns {Promise<string[]>}
**/
export function StringArrayInputStringArrayOut(_in) {
return wails.CallByID(383995060, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function StringArrayInputStringOut
* @param _in {string[]}
* @returns {Promise<string>}
**/
export function StringArrayInputStringOut(_in) {
return wails.CallByID(1091960237, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function StructInputStructOutput
* @param _in {Person}
* @returns {Promise<Person>}
**/
export function StructInputStructOutput(_in) {
return wails.CallByID(3835643147, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function StructPointerInputErrorOutput
* @param _in {Person | null}
* @returns {Promise<void>}
**/
export function StructPointerInputErrorOutput(_in) {
return wails.CallByID(2447692557, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function StructPointerInputStructPointerOutput
* @param _in {Person | null}
* @returns {Promise<Person>}
**/
export function StructPointerInputStructPointerOutput(_in) {
return wails.CallByID(2943477349, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function UInt16InUIntOut
* @param _in {number}
* @returns {Promise<number>}
**/
export function UInt16InUIntOut(_in) {
return wails.CallByID(3401034892, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function UInt16PointerInAndOutput
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
export function UInt16PointerInAndOutput(_in) {
return wails.CallByID(1236957573, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function UInt32InUIntOut
* @param _in {number}
* @returns {Promise<number>}
**/
export function UInt32InUIntOut(_in) {
return wails.CallByID(1160383782, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function UInt32PointerInAndOutput
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
export function UInt32PointerInAndOutput(_in) {
return wails.CallByID(1739300671, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function UInt64InUIntOut
* @param _in {number}
* @returns {Promise<number>}
**/
export function UInt64InUIntOut(_in) {
return wails.CallByID(793803239, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function UInt64PointerInAndOutput
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
export function UInt64PointerInAndOutput(_in) {
return wails.CallByID(1403757716, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function UInt8InUIntOut
* @param _in {number}
* @returns {Promise<number>}
**/
export function UInt8InUIntOut(_in) {
return wails.CallByID(2988345717, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function UInt8PointerInAndOutput
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
export function UInt8PointerInAndOutput(_in) {
return wails.CallByID(518250834, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function UIntInUIntOut
* @param _in {number}
* @returns {Promise<number>}
**/
export function UIntInUIntOut(_in) {
return wails.CallByID(2836661285, ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function UIntPointerInAndOutput
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
export function UIntPointerInAndOutput(_in) {
return wails.CallByID(1367187362, ...Array.prototype.slice.call(arguments, 0));
}

View File

@ -0,0 +1,394 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
/**
* @typedef {import('./models').Person} Person
*/
/**
* @function ArrayInt
* @param _in {number[]}
* @returns {Promise<void>}
**/
export function ArrayInt(_in) {
return wails.CallByName("main.GreetService.ArrayInt", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function BoolInBoolOut
* @param _in {boolean}
* @returns {Promise<boolean>}
**/
export function BoolInBoolOut(_in) {
return wails.CallByName("main.GreetService.BoolInBoolOut", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function Float32InFloat32Out
* @param _in {number}
* @returns {Promise<number>}
**/
export function Float32InFloat32Out(_in) {
return wails.CallByName("main.GreetService.Float32InFloat32Out", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function Float64InFloat64Out
* @param _in {number}
* @returns {Promise<number>}
**/
export function Float64InFloat64Out(_in) {
return wails.CallByName("main.GreetService.Float64InFloat64Out", ...Array.prototype.slice.call(arguments, 0));
}
/**
* Greet someone
* @function Greet
* @param name {string}
* @returns {Promise<string>}
**/
export function Greet(name) {
return wails.CallByName("main.GreetService.Greet", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function Int16InIntOut
* @param _in {number}
* @returns {Promise<number>}
**/
export function Int16InIntOut(_in) {
return wails.CallByName("main.GreetService.Int16InIntOut", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function Int16PointerInAndOutput
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
export function Int16PointerInAndOutput(_in) {
return wails.CallByName("main.GreetService.Int16PointerInAndOutput", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function Int32InIntOut
* @param _in {number}
* @returns {Promise<number>}
**/
export function Int32InIntOut(_in) {
return wails.CallByName("main.GreetService.Int32InIntOut", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function Int32PointerInAndOutput
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
export function Int32PointerInAndOutput(_in) {
return wails.CallByName("main.GreetService.Int32PointerInAndOutput", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function Int64InIntOut
* @param _in {number}
* @returns {Promise<number>}
**/
export function Int64InIntOut(_in) {
return wails.CallByName("main.GreetService.Int64InIntOut", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function Int64PointerInAndOutput
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
export function Int64PointerInAndOutput(_in) {
return wails.CallByName("main.GreetService.Int64PointerInAndOutput", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function Int8InIntOut
* @param _in {number}
* @returns {Promise<number>}
**/
export function Int8InIntOut(_in) {
return wails.CallByName("main.GreetService.Int8InIntOut", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function Int8PointerInAndOutput
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
export function Int8PointerInAndOutput(_in) {
return wails.CallByName("main.GreetService.Int8PointerInAndOutput", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function IntInIntOut
* @param _in {number}
* @returns {Promise<number>}
**/
export function IntInIntOut(_in) {
return wails.CallByName("main.GreetService.IntInIntOut", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function IntPointerInAndOutput
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
export function IntPointerInAndOutput(_in) {
return wails.CallByName("main.GreetService.IntPointerInAndOutput", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function IntPointerInputNamedOutputs
* @param _in {number | null}
* @returns {Promise<number | null, void>}
**/
export function IntPointerInputNamedOutputs(_in) {
return wails.CallByName("main.GreetService.IntPointerInputNamedOutputs", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function MapIntInt
* @param _in {map}
* @returns {Promise<void>}
**/
export function MapIntInt(_in) {
return wails.CallByName("main.GreetService.MapIntInt", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function MapIntPointerInt
* @param _in {map}
* @returns {Promise<void>}
**/
export function MapIntPointerInt(_in) {
return wails.CallByName("main.GreetService.MapIntPointerInt", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function MapIntSliceInt
* @param _in {map}
* @returns {Promise<void>}
**/
export function MapIntSliceInt(_in) {
return wails.CallByName("main.GreetService.MapIntSliceInt", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function MapIntSliceIntInMapIntSliceIntOut
* @param _in {map}
* @returns {Promise<map>}
**/
export function MapIntSliceIntInMapIntSliceIntOut(_in) {
return wails.CallByName("main.GreetService.MapIntSliceIntInMapIntSliceIntOut", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function NoInputsStringOut
* @returns {Promise<string>}
**/
export function NoInputsStringOut() {
return wails.CallByName("main.GreetService.NoInputsStringOut", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function PointerBoolInBoolOut
* @param _in {boolean | null}
* @returns {Promise<boolean | null>}
**/
export function PointerBoolInBoolOut(_in) {
return wails.CallByName("main.GreetService.PointerBoolInBoolOut", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function PointerFloat32InFloat32Out
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
export function PointerFloat32InFloat32Out(_in) {
return wails.CallByName("main.GreetService.PointerFloat32InFloat32Out", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function PointerFloat64InFloat64Out
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
export function PointerFloat64InFloat64Out(_in) {
return wails.CallByName("main.GreetService.PointerFloat64InFloat64Out", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function PointerMapIntInt
* @param _in {map | null}
* @returns {Promise<void>}
**/
export function PointerMapIntInt(_in) {
return wails.CallByName("main.GreetService.PointerMapIntInt", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function PointerStringInStringOut
* @param _in {string | null}
* @returns {Promise<string | null>}
**/
export function PointerStringInStringOut(_in) {
return wails.CallByName("main.GreetService.PointerStringInStringOut", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function StringArrayInputNamedOutput
* @param _in {string[]}
* @returns {Promise<string[]>}
**/
export function StringArrayInputNamedOutput(_in) {
return wails.CallByName("main.GreetService.StringArrayInputNamedOutput", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function StringArrayInputNamedOutputs
* @param _in {string[]}
* @returns {Promise<string[], void>}
**/
export function StringArrayInputNamedOutputs(_in) {
return wails.CallByName("main.GreetService.StringArrayInputNamedOutputs", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function StringArrayInputStringArrayOut
* @param _in {string[]}
* @returns {Promise<string[]>}
**/
export function StringArrayInputStringArrayOut(_in) {
return wails.CallByName("main.GreetService.StringArrayInputStringArrayOut", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function StringArrayInputStringOut
* @param _in {string[]}
* @returns {Promise<string>}
**/
export function StringArrayInputStringOut(_in) {
return wails.CallByName("main.GreetService.StringArrayInputStringOut", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function StructInputStructOutput
* @param _in {Person}
* @returns {Promise<Person>}
**/
export function StructInputStructOutput(_in) {
return wails.CallByName("main.GreetService.StructInputStructOutput", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function StructPointerInputErrorOutput
* @param _in {Person | null}
* @returns {Promise<void>}
**/
export function StructPointerInputErrorOutput(_in) {
return wails.CallByName("main.GreetService.StructPointerInputErrorOutput", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function StructPointerInputStructPointerOutput
* @param _in {Person | null}
* @returns {Promise<Person>}
**/
export function StructPointerInputStructPointerOutput(_in) {
return wails.CallByName("main.GreetService.StructPointerInputStructPointerOutput", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function UInt16InUIntOut
* @param _in {number}
* @returns {Promise<number>}
**/
export function UInt16InUIntOut(_in) {
return wails.CallByName("main.GreetService.UInt16InUIntOut", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function UInt16PointerInAndOutput
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
export function UInt16PointerInAndOutput(_in) {
return wails.CallByName("main.GreetService.UInt16PointerInAndOutput", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function UInt32InUIntOut
* @param _in {number}
* @returns {Promise<number>}
**/
export function UInt32InUIntOut(_in) {
return wails.CallByName("main.GreetService.UInt32InUIntOut", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function UInt32PointerInAndOutput
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
export function UInt32PointerInAndOutput(_in) {
return wails.CallByName("main.GreetService.UInt32PointerInAndOutput", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function UInt64InUIntOut
* @param _in {number}
* @returns {Promise<number>}
**/
export function UInt64InUIntOut(_in) {
return wails.CallByName("main.GreetService.UInt64InUIntOut", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function UInt64PointerInAndOutput
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
export function UInt64PointerInAndOutput(_in) {
return wails.CallByName("main.GreetService.UInt64PointerInAndOutput", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function UInt8InUIntOut
* @param _in {number}
* @returns {Promise<number>}
**/
export function UInt8InUIntOut(_in) {
return wails.CallByName("main.GreetService.UInt8InUIntOut", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function UInt8PointerInAndOutput
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
export function UInt8PointerInAndOutput(_in) {
return wails.CallByName("main.GreetService.UInt8PointerInAndOutput", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function UIntInUIntOut
* @param _in {number}
* @returns {Promise<number>}
**/
export function UIntInUIntOut(_in) {
return wails.CallByName("main.GreetService.UIntInUIntOut", ...Array.prototype.slice.call(arguments, 0));
}
/**
* @function UIntPointerInAndOutput
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
export function UIntPointerInAndOutput(_in) {
return wails.CallByName("main.GreetService.UIntPointerInAndOutput", ...Array.prototype.slice.call(arguments, 0));
}

Some files were not shown because too many files have changed in this diff Show More