Ejemplo n.º 1
0
 public TBuilder Append(ReadOnlySpan <byte> span)
 {
     ValueOffsets.Append(Offset);
     ValueBuffer.Append(span);
     Offset += span.Length;
     return(Instance);
 }
Ejemplo n.º 2
0
 public TBuilder Append(byte value)
 {
     ValueOffsets.Append(Offset);
     ValueBuffer.Append(value);
     Offset++;
     return(Instance);
 }
Ejemplo n.º 3
0
 public Builder NullableAppend(bool?value)
 {
     // Note that we rely on the fact that null values are false in the value buffer.
     ValueBuffer.Append(value ?? false);
     ValidityBuffer.Append(value.HasValue);
     return(this);
 }
Ejemplo n.º 4
0
            private void AppendStringToBuffer(string s)
            {
                var span = Encoding.GetBytes(s);

                ValueOffsets.Append(Offset);
                ValueBuffer.Append(span);
                Offset += span.Length;
            }
Ejemplo n.º 5
0
 public Builder Append(bool value)
 {
     if (Length % 8 == 0)
     {
         // append a new byte to the buffer when needed
         ValueBuffer.Append(0);
     }
     BitUtility.SetBit(ValueBuffer.Span, Length, value);
     Length++;
     return(this);
 }
Ejemplo n.º 6
0
            public TBuilder AppendRange(IEnumerable <byte[]> values)
            {
                foreach (var arr in values)
                {
                    var len = ValueBuffer.Length;
                    ValueOffsets.Append(Offset);
                    ValueBuffer.Append(arr);
                    Offset += ValueBuffer.Length - len;
                }

                return(Instance);
            }
Ejemplo n.º 7
0
 private Builder NullableAppend(bool?value)
 {
     if (Length % 8 == 0)
     {
         // append a new byte to the buffer when needed
         ValueBuffer.Append(0);
         ValidityBuffer.Append(0);
     }
     BitUtility.SetBit(ValueBuffer.Span, Length, value.GetValueOrDefault());
     BitUtility.SetBit(ValidityBuffer.Span, Length, value.HasValue);
     NullCount += value.HasValue ? 0 : 1;
     Length++;
     return(this);
 }
Ejemplo n.º 8
0
            public TBuilder AppendRange(IEnumerable <byte[]> values)
            {
                foreach (byte[] arr in values)
                {
                    if (arr == null)
                    {
                        AppendNull();
                        continue;
                    }
                    int len = ValueBuffer.Length;
                    ValueOffsets.Append(Offset);
                    ValueBuffer.Append(arr);
                    ValidityBuffer.Append(true);
                    Offset += ValueBuffer.Length - len;
                }

                return(Instance);
            }
Ejemplo n.º 9
0
 public TBuilder AppendNull()
 {
     ValueBuffer.Append(new byte[ByteWidth]);
     ValidityBuffer.Append(false);
     return(Instance);
 }
Ejemplo n.º 10
0
 public TBuilder Append(ReadOnlySpan <byte> span)
 {
     ValueBuffer.Append(span);
     ValidityBuffer.Append(true);
     return(Instance);
 }