github.com/AlpineAIO/wails/v2@v2.0.0-beta.32.0.20240505041856-1047a8fa5fef/internal/binding/binding_test/binding_multiplestructs_test.go (about) 1 package binding_test 2 3 type Multistruct1 struct { 4 Name string `json:"name"` 5 } 6 7 func (s Multistruct1) Get() Multistruct1 { 8 return s 9 } 10 11 type Multistruct2 struct { 12 Name string `json:"name"` 13 } 14 15 func (s Multistruct2) Get() Multistruct2 { 16 return s 17 } 18 19 type Multistruct3 struct { 20 Name string `json:"name"` 21 } 22 23 func (s Multistruct3) Get() Multistruct3 { 24 return s 25 } 26 27 type Multistruct4 struct { 28 Name string `json:"name"` 29 } 30 31 func (s Multistruct4) Get() Multistruct4 { 32 return s 33 } 34 35 var MultistructTest = BindingTest{ 36 name: "Multistruct", 37 structs: []interface{}{ 38 &Multistruct1{}, 39 &Multistruct2{}, 40 &Multistruct3{}, 41 &Multistruct4{}, 42 }, 43 exemptions: nil, 44 shouldError: false, 45 want: `export namespace binding_test { 46 export class Multistruct1 { 47 name: string; 48 static createFrom(source: any = {}) { 49 return new Multistruct1(source); 50 } 51 constructor(source: any = {}) { 52 if ('string' === typeof source) source = JSON.parse(source); 53 this.name = source["name"]; 54 } 55 } 56 export class Multistruct2 { 57 name: string; 58 static createFrom(source: any = {}) { 59 return new Multistruct2(source); 60 } 61 constructor(source: any = {}) { 62 if ('string' === typeof source) source = JSON.parse(source); 63 this.name = source["name"]; 64 } 65 } 66 export class Multistruct3 { 67 name: string; 68 static createFrom(source: any = {}) { 69 return new Multistruct3(source); 70 } 71 constructor(source: any = {}) { 72 if ('string' === typeof source) source = JSON.parse(source); 73 this.name = source["name"]; 74 } 75 } 76 export class Multistruct4 { 77 name: string; 78 static createFrom(source: any = {}) { 79 return new Multistruct4(source); 80 } 81 constructor(source: any = {}) { 82 if ('string' === typeof source) source = JSON.parse(source); 83 this.name = source["name"]; 84 } 85 } 86 } 87 `, 88 }