MCPcopy Create free account
hub / github.com/chronoxor/FastBinaryEncoding / main

Function main

projects/Go/examples/print.go:6–202  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4import "../proto/test"
5
6func main() {
7 fmt.Println(test.NewStructSimple())
8 fmt.Println()
9
10 fmt.Println(test.NewStructOptional())
11 fmt.Println()
12
13 fmt.Println(test.NewStructNested())
14 fmt.Println()
15
16 // Print bytes struct
17 structBytes := test.NewStructBytes()
18 bytesF1 := []byte("ABC")
19 structBytes.F1 = bytesF1
20 bytesF2 := []byte("test")
21 structBytes.F2 = &bytesF2
22 fmt.Println(structBytes)
23 fmt.Println()
24
25 // Print array struct
26 structArray := test.NewStructArray()
27 structArray.F1[0] = 48
28 structArray.F1[1] = 65
29 arrayF2 := byte(97)
30 structArray.F2[0] = &arrayF2
31 structArray.F2[1] = nil
32 structArray.F3[0] = []byte("000")
33 structArray.F3[1] = []byte("AAA")
34 arrayF4 := []byte("aaa")
35 structArray.F4[0] = &arrayF4
36 structArray.F4[1] = nil
37 structArray.F5[0] = test.EnumSimple_ENUM_VALUE_1
38 structArray.F5[1] = test.EnumSimple_ENUM_VALUE_2
39 arrayF6 := test.EnumSimple_ENUM_VALUE_1
40 structArray.F6[0] = &arrayF6
41 structArray.F6[1] = nil
42 structArray.F7[0] = test.FlagsSimple_FLAG_VALUE_1 | test.FlagsSimple_FLAG_VALUE_2
43 structArray.F7[1] = test.FlagsSimple_FLAG_VALUE_1 | test.FlagsSimple_FLAG_VALUE_2 | test.FlagsSimple_FLAG_VALUE_3
44 arrayF8 := test.FlagsSimple_FLAG_VALUE_1 | test.FlagsSimple_FLAG_VALUE_2
45 structArray.F8[0] = &arrayF8
46 structArray.F8[1] = nil
47 structArray.F9[0] = *test.NewStructSimple()
48 structArray.F9[1] = *test.NewStructSimple()
49 structArray.F10[0] = test.NewStructSimple()
50 structArray.F10[1] = nil
51 fmt.Println(structArray)
52 fmt.Println()
53
54 // Print vector struct
55 structVector := test.NewStructVector()
56 structVector.F1 = append(structVector.F1, 48)
57 structVector.F1 = append(structVector.F1, 65)
58 vectorF2 := byte(97)
59 structVector.F2 = append(structVector.F2, &vectorF2)
60 structVector.F2 = append(structVector.F2, nil)
61 structVector.F3 = append(structVector.F3, []byte("000"))
62 structVector.F3 = append(structVector.F3, []byte("AAA"))
63 vectorF4 := []byte("aaa")

Callers

nothing calls this directly

Calls 2

KeyMethod · 0.95
AddMethod · 0.45

Tested by

no test coverage detected