MCPcopy Create free account
hub / github.com/araddon/qlbridge / MarshalTo

Method MarshalTo

rel/sql.pb.go:1117–1169  ·  view source on GitHub ↗
(data []byte)

Source from the content-addressed store, hash-verified

1115}
1116
1117func (m *ProjectionPb) MarshalTo(data []byte) (int, error) {
1118 var i int
1119 _ = i
1120 var l int
1121 _ = l
1122 data[i] = 0x8
1123 i++
1124 if m.Distinct {
1125 data[i] = 1
1126 } else {
1127 data[i] = 0
1128 }
1129 i++
1130 data[i] = 0x10
1131 i++
1132 if m.Final {
1133 data[i] = 1
1134 } else {
1135 data[i] = 0
1136 }
1137 i++
1138 if len(m.ColNames) > 0 {
1139 for _, s := range m.ColNames {
1140 data[i] = 0x1a
1141 i++
1142 l = len(s)
1143 for l >= 1<<7 {
1144 data[i] = uint8(uint64(l)&0x7f | 0x80)
1145 l >>= 7
1146 i++
1147 }
1148 data[i] = uint8(l)
1149 i++
1150 i += copy(data[i:], s)
1151 }
1152 }
1153 if len(m.Columns) > 0 {
1154 for _, msg := range m.Columns {
1155 data[i] = 0x22
1156 i++
1157 i = encodeVarintSql(data, i, uint64(msg.Size()))
1158 n, err := msg.MarshalTo(data[i:])
1159 if err != nil {
1160 return 0, err
1161 }
1162 i += n
1163 }
1164 }
1165 if m.XXX_unrecognized != nil {
1166 i += copy(data[i:], m.XXX_unrecognized)
1167 }
1168 return i, nil
1169}
1170
1171func (m *ResultColumnPb) Marshal() (data []byte, err error) {
1172 size := m.Size()

Callers 1

MarshalMethod · 0.95

Calls 3

encodeVarintSqlFunction · 0.85
SizeMethod · 0.45
MarshalToMethod · 0.45

Tested by

no test coverage detected