public override object Deserialize(IPackStreamReader reader, byte signature, long size)
        {
            var urn     = reader.ReadLong();
            var relType = reader.ReadString();
            var props   = reader.ReadMap();

            return(new Relationship(urn, -1, -1, relType, props));
        }
Example #2
0
        public override object Read(IPackStreamReader reader, byte signature, long size)
        {
            var urn      = reader.ReadLong();
            var startUrn = reader.ReadLong();
            var endUrn   = reader.ReadLong();
            var relType  = reader.ReadString();
            var props    = reader.ReadMap();

            return(new Relationship(urn, startUrn, endUrn, relType, props));
        }
        public object Read(IPackStreamReader reader, byte signature, long size)
        {
            PackStream.EnsureStructSize("DateTimeWithZoneId", StructSize, size);

            var epochSecondsUtc = reader.ReadLong();
            var nanosOfSecond   = reader.ReadInteger();
            var zoneId          = reader.ReadString();

            return(new CypherDateTimeWithZoneId(epochSecondsUtc, nanosOfSecond, zoneId));
        }
        public override object Read(IPackStreamReader reader, byte signature, long size)
        {
            var urn = reader.ReadLong();

            var numLabels = (int)reader.ReadListHeader();
            var labels    = new List <string>(numLabels);

            for (var i = 0; i < numLabels; i++)
            {
                labels.Add(reader.ReadString());
            }
            var numProps = (int)reader.ReadMapHeader();
            var props    = new Dictionary <string, object>(numProps);

            for (var j = 0; j < numProps; j++)
            {
                var key = reader.ReadString();
                props.Add(key, reader.Read());
            }

            return(new Node(urn, labels, props));
        }
        public object Deserialize(IPackStreamReader reader, byte signature, long size)
        {
            PackStream.EnsureStructSize($"ZonedDateTime[{(char) signature}]", StructSize, size);

            var epochSecondsUtc = reader.ReadLong();
            var nanosOfSecond   = reader.ReadInteger();

            switch (signature)
            {
            case StructTypeWithId:
                return(new ZonedDateTime(
                           TemporalHelpers.EpochSecondsAndNanoToDateTime(epochSecondsUtc, nanosOfSecond),
                           Zone.Of(reader.ReadString())));

            case StructTypeWithOffset:
                return(new ZonedDateTime(
                           TemporalHelpers.EpochSecondsAndNanoToDateTime(epochSecondsUtc, nanosOfSecond),
                           Zone.Of(reader.ReadInteger())));

            default:
                throw new ProtocolException(
                          $"Unsupported struct signature {signature} passed to {nameof(ZonedDateTimeSerializer)}!");
            }
        }