public object Convert(
            int oid,
            DataRow row,
            PostgresFormatCode formatCode,
            PostgresClientState state)
        {
            if (!_oidCodecLookup.TryGetValue(oid, out var typeConverter))
            {
                // TODO
                throw new InvalidOperationException("Unknown oid " + oid);
            }

            var codec = typeConverter.Codec;

            if (codec == null)
            {
                throw new NotImplementedException(
                          $"Convertion of type '{typeConverter.Name}' ({oid}) is not supported.");
            }

            switch (formatCode)
            {
            case PostgresFormatCode.Text:
                return(codec.DecodeTextObject(row, state));

            case PostgresFormatCode.Binary:
                return(codec.DecodeBinaryObject(row, state));
            }

            throw new ArgumentOutOfRangeException(
                      nameof(formatCode), formatCode,
                      "Unknown format code.");
        }
        public T Decode(
            DataRow row,
            PostgresFormatCode formatCode,
            PostgresClientState state)
        {
            switch (formatCode)
            {
            case PostgresFormatCode.Text:
                return(DecodeText(row, state));

            case PostgresFormatCode.Binary:
                return(DecodeBinary(row, state));
            }

            throw new ArgumentOutOfRangeException(
                      nameof(formatCode), formatCode,
                      "Unknown format code.");
        }