-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmodel.go
More file actions
172 lines (141 loc) · 4 KB
/
model.go
File metadata and controls
172 lines (141 loc) · 4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
// wasmcloud core data models for messaging and code generation
package actor
import (
cbor "github.com/wasmcloud/tinygo-cbor" //nolint
msgpack "github.com/wasmcloud/tinygo-msgpack" //nolint
)
// Capability contract id, e.g. 'wasmcloud:httpserver'
// This declaration supports code generations and is not part of an actor or provider sdk
type CapabilityContractId string
// MEncode serializes a CapabilityContractId using msgpack
func (o *CapabilityContractId) MEncode(encoder msgpack.Writer) error {
encoder.WriteString(string(*o))
return encoder.CheckError()
}
// MDecodeCapabilityContractId deserializes a CapabilityContractId using msgpack
func MDecodeCapabilityContractId(d *msgpack.Decoder) (CapabilityContractId, error) {
val, err := d.ReadString()
if err != nil {
return "", err
}
return CapabilityContractId(val), nil
}
// CEncode serializes a CapabilityContractId using cbor
func (o *CapabilityContractId) CEncode(encoder cbor.Writer) error {
encoder.WriteString(string(*o))
return encoder.CheckError()
}
// CDecodeCapabilityContractId deserializes a CapabilityContractId using cbor
func CDecodeCapabilityContractId(d *cbor.Decoder) (CapabilityContractId, error) {
val, err := d.ReadString()
if err != nil {
return "", err
}
return CapabilityContractId(val), nil
}
// 32-bit float
type F32 float32
// 64-bit float aka double
type F64 float64
// signed 16-bit int
type I16 int16
// signed 32-bit int
type I32 int32
// signed 64-bit int
type I64 int64
// signed byte
type I8 int8
// list of identifiers
// This declaration supports code generations and is not part of an actor or provider sdk
type IdentifierList []string
// MEncode serializes a IdentifierList using msgpack
func (o *IdentifierList) MEncode(encoder msgpack.Writer) error {
encoder.WriteArraySize(uint32(len(*o)))
for _, item_o := range *o {
encoder.WriteString(item_o)
}
return encoder.CheckError()
}
// MDecodeIdentifierList deserializes a IdentifierList using msgpack
func MDecodeIdentifierList(d *msgpack.Decoder) (IdentifierList, error) {
isNil, err := d.IsNextNil()
if err != nil || isNil {
return make([]string, 0), err
}
size, err := d.ReadArraySize()
if err != nil {
return make([]string, 0), err
}
val := make([]string, size)
for i := uint32(0); i < size; i++ {
item, err := d.ReadString()
if err != nil {
return val, err
}
val = append(val, item)
}
return val, nil
}
// CEncode serializes a IdentifierList using cbor
func (o *IdentifierList) CEncode(encoder cbor.Writer) error {
encoder.WriteArraySize(uint32(len(*o)))
for _, item_o := range *o {
encoder.WriteString(item_o)
}
return encoder.CheckError()
}
// CDecodeIdentifierList deserializes a IdentifierList using cbor
func CDecodeIdentifierList(d *cbor.Decoder) (IdentifierList, error) {
isNil, err := d.IsNextNil()
if err != nil || isNil {
return make([]string, 0), err
}
size, indef, err := d.ReadArraySize()
if err != nil && indef {
err = cbor.NewReadError("indefinite arrays not supported")
}
if err != nil {
return make([]string, 0), err
}
val := make([]string, size)
for i := uint32(0); i < size; i++ {
item, err := d.ReadString()
if err != nil {
return val, err
}
val = append(val, item)
}
return val, nil
}
// unsigned 16-bit int
type U16 int16
// unsigned 32-bit int
type U32 int32
// unsigned 64-bit int
type U64 int64
// unsigned byte
type U8 int8
// Unit type
type Unit struct {
}
// MEncode serializes a Unit using msgpack
func (o *Unit) MEncode(encoder msgpack.Writer) error {
encoder.WriteNil()
return encoder.CheckError()
}
// MDecodeUnit deserializes a Unit using msgpack
func MDecodeUnit(d *msgpack.Decoder) (Unit, error) {
_ = d.Skip()
return Unit{}, nil
}
// CEncode serializes a Unit using cbor
func (o *Unit) CEncode(encoder cbor.Writer) error {
encoder.WriteNil()
return encoder.CheckError()
}
// CDecodeUnit deserializes a Unit using cbor
func CDecodeUnit(d *cbor.Decoder) (Unit, error) {
_ = d.Skip()
return Unit{}, nil
}
// This file is generated automatically using wasmcloud/weld-codegen 0.4.4