summaryrefslogtreecommitdiffhomepage
path: root/cmd/fastjson/testcodegen/json_gen.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/fastjson/testcodegen/json_gen.go')
-rw-r--r--cmd/fastjson/testcodegen/json_gen.go141
1 files changed, 141 insertions, 0 deletions
diff --git a/cmd/fastjson/testcodegen/json_gen.go b/cmd/fastjson/testcodegen/json_gen.go
new file mode 100644
index 000000000..02b9cb5bb
--- /dev/null
+++ b/cmd/fastjson/testcodegen/json_gen.go
@@ -0,0 +1,141 @@
+// Code generated by TODO; DO NOT EDIT.
+
+package testcodegen
+
+import (
+ "encoding/base64"
+ "strconv"
+)
+
+// MarshalJSONInto marshals this PingRequest into JSON in the provided buffer.
+func (self *PingRequest) MarshalJSONInto(buf []byte) ([]byte, error) {
+ var err error
+ _ = err
+ buf = append(buf, '{')
+
+ // Encode field URL of type "string"
+ buf = append(buf, []byte("\"URL\":")...)
+ buf = strconv.AppendQuote(buf, self.URL)
+ buf = append(buf, ',')
+
+ // Encode field URLIsNoise of type "bool"
+ buf = append(buf, []byte("\"URLIsNoise\":")...)
+ if self.URLIsNoise {
+ buf = append(buf, []byte("true")...)
+ } else {
+ buf = append(buf, []byte("false")...)
+ }
+ buf = append(buf, ',')
+
+ // Encode field Log of type "bool"
+ buf = append(buf, []byte("\"Log\":")...)
+ if self.Log {
+ buf = append(buf, []byte("true")...)
+ } else {
+ buf = append(buf, []byte("false")...)
+ }
+ buf = append(buf, ',')
+
+ // Encode field Types of type "string"
+ buf = append(buf, []byte("\"Types\":")...)
+ buf = strconv.AppendQuote(buf, self.Types)
+ buf = append(buf, ',')
+
+ // Encode field IP of type "string"
+ buf = append(buf, []byte("\"IP\":")...)
+ buf = strconv.AppendQuote(buf, self.IP)
+ buf = append(buf, ',')
+
+ // Encode field Payload of type "[]byte"
+ buf = append(buf, []byte("\"Payload\":")...)
+ buf = append(buf, '"')
+ {
+ encodedLen := base64.StdEncoding.EncodedLen(len(self.Payload))
+ offset := len(buf)
+ buf = append(buf, make([]byte, encodedLen)...)
+ base64.StdEncoding.Encode(buf[offset:], self.Payload)
+ }
+ buf = append(buf, '"')
+ buf = append(buf, ',')
+
+ // Encode field IntList of type "[]int"
+ buf = append(buf, []byte("\"IntList\":")...)
+ buf = append(buf, '[')
+ for i, elem := range self.IntList {
+ if i > 0 {
+ buf = append(buf, ',')
+ }
+ buf = strconv.AppendInt(buf, int64(elem), 10)
+ }
+ buf = append(buf, ']')
+ buf = append(buf, ',')
+
+ // Encode field Uint32List of type "[]uint32"
+ buf = append(buf, []byte("\"Uint32List\":")...)
+ buf = append(buf, '[')
+ for i, elem := range self.Uint32List {
+ if i > 0 {
+ buf = append(buf, ',')
+ }
+ buf = strconv.AppendUint(buf, uint64(elem), 10)
+ }
+ buf = append(buf, ']')
+ buf = append(buf, ',')
+
+ // Encode field StringPtr of type "*string"
+ buf = append(buf, []byte("\"StringPtr\":")...)
+ if self.StringPtr != nil {
+ buf = strconv.AppendQuote(buf, (*self.StringPtr))
+ } else {
+ buf = append(buf, []byte("null")...)
+ }
+ buf = append(buf, ',')
+
+ // Encode field StructPtr of type "*tailscale.com/cmd/fastjson/testcodegen.OtherStruct"
+ buf = append(buf, []byte("\"StructPtr\":")...)
+ if self.StructPtr != nil {
+ buf, err = self.StructPtr.MarshalJSONInto(buf)
+ if err != nil {
+ return nil, err
+ }
+ } else {
+ buf = append(buf, []byte("null")...)
+ }
+ buf = append(buf, ',')
+
+ // Encode field MultiPtr of type "***int"
+ buf = append(buf, []byte("\"MultiPtr\":")...)
+ if self.MultiPtr != nil {
+ if (*self.MultiPtr) != nil {
+ if (*(*self.MultiPtr)) != nil {
+ buf = strconv.AppendInt(buf, int64((*(*(*self.MultiPtr)))), 10)
+ } else {
+ buf = append(buf, []byte("null")...)
+ }
+ } else {
+ buf = append(buf, []byte("null")...)
+ }
+ } else {
+ buf = append(buf, []byte("null")...)
+ }
+ buf = append(buf, '}')
+ return buf, nil
+}
+
+// MarshalJSONInto marshals this OtherStruct into JSON in the provided buffer.
+func (self *OtherStruct) MarshalJSONInto(buf []byte) ([]byte, error) {
+ var err error
+ _ = err
+ buf = append(buf, '{')
+
+ // Encode field Name of type "string"
+ buf = append(buf, []byte("\"Name\":")...)
+ buf = strconv.AppendQuote(buf, self.Name)
+ buf = append(buf, ',')
+
+ // Encode field Age of type "int"
+ buf = append(buf, []byte("\"Age\":")...)
+ buf = strconv.AppendInt(buf, int64(self.Age), 10)
+ buf = append(buf, '}')
+ return buf, nil
+}