File: test_message_gen.go

package info (click to toggle)
golang-github-fluent-fluent-logger-golang 1.9.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bookworm-proposed-updates, forky, sid, trixie
  • size: 208 kB
  • sloc: makefile: 4
file content (135 lines) | stat: -rw-r--r-- 2,827 bytes parent folder | download | duplicates (2)
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
package fluent

// Code generated by github.com/tinylib/msgp DO NOT EDIT.

import (
	"github.com/tinylib/msgp/msgp"
)

// DecodeMsg implements msgp.Decodable
func (z *TestMessage) DecodeMsg(dc *msgp.Reader) (err error) {
	var field []byte
	_ = field
	var zb0001 uint32
	zb0001, err = dc.ReadMapHeader()
	if err != nil {
		err = msgp.WrapError(err)
		return
	}
	for zb0001 > 0 {
		zb0001--
		field, err = dc.ReadMapKeyPtr()
		if err != nil {
			err = msgp.WrapError(err)
			return
		}
		switch msgp.UnsafeString(field) {
		case "foo":
			z.Foo, err = dc.ReadString()
			if err != nil {
				err = msgp.WrapError(err, "Foo")
				return
			}
		case "hoge":
			z.Hoge, err = dc.ReadString()
			if err != nil {
				err = msgp.WrapError(err, "Hoge")
				return
			}
		default:
			err = dc.Skip()
			if err != nil {
				err = msgp.WrapError(err)
				return
			}
		}
	}
	return
}

// EncodeMsg implements msgp.Encodable
func (z TestMessage) EncodeMsg(en *msgp.Writer) (err error) {
	// map header, size 2
	// write "foo"
	err = en.Append(0x82, 0xa3, 0x66, 0x6f, 0x6f)
	if err != nil {
		return
	}
	err = en.WriteString(z.Foo)
	if err != nil {
		err = msgp.WrapError(err, "Foo")
		return
	}
	// write "hoge"
	err = en.Append(0xa4, 0x68, 0x6f, 0x67, 0x65)
	if err != nil {
		return
	}
	err = en.WriteString(z.Hoge)
	if err != nil {
		err = msgp.WrapError(err, "Hoge")
		return
	}
	return
}

// MarshalMsg implements msgp.Marshaler
func (z TestMessage) MarshalMsg(b []byte) (o []byte, err error) {
	o = msgp.Require(b, z.Msgsize())
	// map header, size 2
	// string "foo"
	o = append(o, 0x82, 0xa3, 0x66, 0x6f, 0x6f)
	o = msgp.AppendString(o, z.Foo)
	// string "hoge"
	o = append(o, 0xa4, 0x68, 0x6f, 0x67, 0x65)
	o = msgp.AppendString(o, z.Hoge)
	return
}

// UnmarshalMsg implements msgp.Unmarshaler
func (z *TestMessage) UnmarshalMsg(bts []byte) (o []byte, err error) {
	var field []byte
	_ = field
	var zb0001 uint32
	zb0001, bts, err = msgp.ReadMapHeaderBytes(bts)
	if err != nil {
		err = msgp.WrapError(err)
		return
	}
	for zb0001 > 0 {
		zb0001--
		field, bts, err = msgp.ReadMapKeyZC(bts)
		if err != nil {
			err = msgp.WrapError(err)
			return
		}
		switch msgp.UnsafeString(field) {
		case "foo":
			z.Foo, bts, err = msgp.ReadStringBytes(bts)
			if err != nil {
				err = msgp.WrapError(err, "Foo")
				return
			}
		case "hoge":
			z.Hoge, bts, err = msgp.ReadStringBytes(bts)
			if err != nil {
				err = msgp.WrapError(err, "Hoge")
				return
			}
		default:
			bts, err = msgp.Skip(bts)
			if err != nil {
				err = msgp.WrapError(err)
				return
			}
		}
	}
	o = bts
	return
}

// Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (z TestMessage) Msgsize() (s int) {
	s = 1 + 4 + msgp.StringPrefixSize + len(z.Foo) + 5 + msgp.StringPrefixSize + len(z.Hoge)
	return
}