MCPcopy Create free account
hub / github.com/dolthub/doltgresql / randFieldTimestamp

Function randFieldTimestamp

postgres/parser/hlc/timestamp.pb.go:185–210  ·  view source on GitHub ↗
(dAtA []byte, r randyTimestamp, fieldNumber int, wire int)

Source from the content-addressed store, hash-verified

183 return dAtA
184}
185func randFieldTimestamp(dAtA []byte, r randyTimestamp, fieldNumber int, wire int) []byte {
186 key := uint32(fieldNumber)<<3 | uint32(wire)
187 switch wire {
188 case 0:
189 dAtA = encodeVarintPopulateTimestamp(dAtA, uint64(key))
190 v2 := r.Int63()
191 if r.Intn(2) == 0 {
192 v2 *= -1
193 }
194 dAtA = encodeVarintPopulateTimestamp(dAtA, uint64(v2))
195 case 1:
196 dAtA = encodeVarintPopulateTimestamp(dAtA, uint64(key))
197 dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)))
198 case 2:
199 dAtA = encodeVarintPopulateTimestamp(dAtA, uint64(key))
200 ll := r.Intn(100)
201 dAtA = encodeVarintPopulateTimestamp(dAtA, uint64(ll))
202 for j := 0; j < ll; j++ {
203 dAtA = append(dAtA, byte(r.Intn(256)))
204 }
205 default:
206 dAtA = encodeVarintPopulateTimestamp(dAtA, uint64(key))
207 dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)))
208 }
209 return dAtA
210}
211func encodeVarintPopulateTimestamp(dAtA []byte, v uint64) []byte {
212 for v >= 1<<7 {
213 dAtA = append(dAtA, uint8(uint64(v)&0x7f|0x80))

Callers 1

Calls 3

Int63Method · 0.65
IntnMethod · 0.65

Tested by

no test coverage detected