public void Write(InsertReplaceRequest <T> value, IMsgPackWriter writer)
        {
            writer.WriteMapHeader(2);

            _keyConverter.Write(Key.SpaceId, writer);
            _uintConverter.Write(value.SpaceId, writer);

            _keyConverter.Write(Key.Tuple, writer);
            _tupleConverter.Write(value.Tuple, writer);
        }
        public void Write(StringSliceOperation value, IMsgPackWriter writer)
        {
            writer.WriteArrayHeader(5);

            _stringConverter.Write(value.OperationType, writer);
            _intConverter.Write(value.FieldNumber, writer);
            _intConverter.Write(value.Position, writer);
            _intConverter.Write(value.Offset, writer);
            _stringConverter.Write(value.Argument, writer);
        }
        public void Write(CallRequest <T> value, IMsgPackWriter writer)
        {
            writer.WriteMapHeader(2);

            _keyConverter.Write(Key.FunctionName, writer);
            _stringConverter.Write(value.FunctionName, writer);

            _keyConverter.Write(Key.Tuple, writer);
            _tupleConverter.Write(value.Tuple, writer);
        }
        public void Write(EvalRequest <T> value, IMsgPackWriter writer)
        {
            writer.WriteMapHeader(2);

            _keyConverter.Write(Key.Expression, writer);
            _stringConverter.Write(value.Expression, writer);

            _keyConverter.Write(Key.Tuple, writer);
            _tupleConverter.Write(value.Tuple, writer);
        }
Beispiel #5
0
        public void Write(DeleteRequest <T> value, IMsgPackWriter writer)
        {
            writer.WriteMapHeader(3);

            _keyConverter.Write(Key.SpaceId, writer);
            _uintConverter.Write(value.SpaceId, writer);

            _keyConverter.Write(Key.IndexId, writer);
            _uintConverter.Write(value.IndexId, writer);

            _keyConverter.Write(Key.Key, writer);
            _selectKeyConverter.Write(value.Key, writer);
        }
        public void Write(RequestHeader value, IMsgPackWriter writer)
        {
            if (value == null)
            {
                _nullConverter.Write(null, writer);
                return;
            }

            writer.WriteMapHeader(2u);

            _keyConverter.Write(Key.Code, writer);
            _codeConverter.Write(value.Code, writer);

            _keyConverter.Write(Key.Sync, writer);
            _requestIdConverter.Write(value.RequestId, writer);
        }
        public void Write(UpdateOperation <T> value, IMsgPackWriter writer)
        {
            writer.WriteArrayHeader(3);

            _stringConverter.Write(value.OperationType, writer);
            _intConverter.Write(value.FieldNumber, writer);
            _argumentConverter.Write(value.Argument, writer);
        }
        public void Write(TarantoolTuple value, IMsgPackWriter writer)
        {
            if (value == null)
            {
                _nullConverter.Write(null, writer);
                return;
            }

            writer.WriteArrayHeader(0);
        }
Beispiel #9
0
        public void Write(AuthenticationRequest value, IMsgPackWriter writer)
        {
            if (value == null)
            {
                _nullConverter.Write(null, writer);
                return;
            }

            writer.WriteMapHeader(2);

            _keyConverter.Write(Key.Username, writer);
            _stringConverter.Write(value.Username, writer);

            _keyConverter.Write(Key.Tuple, writer);

            writer.WriteArrayHeader(2);
            _stringConverter.Write("chap-sha1", writer);
            _bytesConverter.Write(value.Scramble, writer);
        }
Beispiel #10
0
        public void Write(UpsertRequest <T> value, IMsgPackWriter writer)
        {
            writer.WriteMapHeader(3);

            _keyConverter.Write(Key.SpaceId, writer);
            _uintConverter.Write(value.SpaceId, writer);

            _keyConverter.Write(Key.Tuple, writer);
            _tupleConverter.Write(value.Tuple, writer);

            _keyConverter.Write(Key.Ops, writer);
            writer.WriteArrayHeader((uint)value.UpdateOperations.Length);

            foreach (var updateOperation in value.UpdateOperations)
            {
                var operationConverter = updateOperation.GetConverter(_context);
                operationConverter.Write(updateOperation, writer);
            }
        }
Beispiel #11
0
 public void Write(T?value, IMsgPackWriter writer)
 {
     if (value.HasValue)
     {
         _converter.Write(value.Value, writer);
     }
     else
     {
         _context.NullConverter.Write(null, writer);
     }
 }
Beispiel #12
0
 private void InitializeWriteMethodsChache()
 {
     _writeMethodsCache.Add(typeof(sbyte), (value, writer) => _sbyteConverter.Write(value.ToSByte(CultureInfo.InvariantCulture), writer));
     _writeMethodsCache.Add(typeof(byte), (value, writer) => _byteConverter.Write(value.ToByte(CultureInfo.InvariantCulture), writer));
     _writeMethodsCache.Add(typeof(short), (value, writer) => _shortConverter.Write(value.ToInt16(CultureInfo.InvariantCulture), writer));
     _writeMethodsCache.Add(typeof(ushort), (value, writer) => _ushortConverter.Write(value.ToUInt16(CultureInfo.InvariantCulture), writer));
     _writeMethodsCache.Add(typeof(int), (value, writer) => _intConverter.Write(value.ToInt32(CultureInfo.InvariantCulture), writer));
     _writeMethodsCache.Add(typeof(uint), (value, writer) => _uintConverter.Write(value.ToUInt32(CultureInfo.InvariantCulture), writer));
     _writeMethodsCache.Add(typeof(long), (value, writer) => _longConverter.Write(value.ToInt64(CultureInfo.InvariantCulture), writer));
     _writeMethodsCache.Add(typeof(ulong), (value, writer) => _ulongConverter.Write(value.ToUInt64(CultureInfo.InvariantCulture), writer));
 }
Beispiel #13
0
        public void Write(Beer value, IMsgPackWriter writer)
        {
            if (value == null)
            {
                _context.NullConverter.Write(null, writer);
                return;
            }

            writer.WriteMapHeader(4);
            writer.Write(_brand);
            _stringConverter.Write(value.Brand, writer);

            writer.Write(_sort);
            _listStringConverter.Write(value.Sort, writer);

            writer.Write(_alcohol);
            _floatConverter.Write(value.Alcohol, writer);

            writer.Write(_brewery);
            _stringConverter.Write(value.Brewery, writer);
        }
Beispiel #14
0
        public void Write(Tuple <T1> value, IMsgPackWriter writer)
        {
            if (value == null)
            {
                _nullConverter.Write(null, writer);
                return;
            }

            writer.WriteArrayHeader(1);

            _t1Converter.Write(value.Item1, writer);
        }
        public void Write(SelectRequest <T> value, IMsgPackWriter writer)
        {
            writer.WriteMapHeader(6);

            _keyConverter.Write(Key.SpaceId, writer);
            _uintConverter.Write(value.SpaceId, writer);

            _keyConverter.Write(Key.IndexId, writer);
            _uintConverter.Write(value.IndexId, writer);

            _keyConverter.Write(Key.Limit, writer);
            _uintConverter.Write(value.Limit, writer);

            _keyConverter.Write(Key.Offset, writer);
            _uintConverter.Write(value.Offset, writer);

            _keyConverter.Write(Key.Iterator, writer);
            _iteratorConverter.Write(value.Iterator, writer);

            _keyConverter.Write(Key.Key, writer);
            _selectKeyConverter.Write(value.SelectKey, writer);
        }
        public void Write(ExecuteSqlRequest value, IMsgPackWriter writer)
        {
            if (!_initialized)
            {
                InitializeIfNeeded();
            }

            writer.WriteMapHeader(3u);

            _keyConverter.Write(Key.SqlQueryText, writer);
            _stringConverter.Write(value.Query, writer);

            _keyConverter.Write(Key.SqlParameters, writer);
            writer.WriteArrayHeader((uint)value.Parameters.Count);
            foreach (var parameter in value.Parameters)
            {
                parameter.Write(_context, writer, _stringConverter);
            }

            _keyConverter.Write(Key.SqlOptions, writer);
            _nullConverter.Write(null, writer);
        }
Beispiel #17
0
        public void Write(ValueTuple <T1> value, IMsgPackWriter writer)
        {
            writer.WriteArrayHeader(1);

            _t1Converter.Write(value.Item1, writer);
        }
 public void Write(T value, IMsgPackWriter writer)
 {
     _stringConverter.Write(value.ToString(CultureInfo.InvariantCulture), writer);
 }