File: D:/Python311/Lib/site-packages/mysqlx/__pycache__/dbdoc.cpython-311.pyc
�
�nc� � �^ � d Z ddlZddlmZ G d� dej � � Z G d� d� � ZdS ) zImplementation of the DbDoc.� N� )�ProgrammingErrorc � � e Zd ZdZd� ZdS )�ExprJSONEncoderzgA :class:`json.JSONEncoder` subclass, which enables encoding of
:class:`mysqlx.ExprParser` objects.c �h � t |d� � r|� S t j � | |� � S )N�expr)�hasattr�json�JSONEncoder�default)�self�os �.D:\Python311\Lib\site-packages\mysqlx/dbdoc.pyr zExprJSONEncoder.default( s4 � ��1�f��� ��6�M���'�'��a�0�0�0� N)�__name__�
__module__�__qualname__�__doc__r � r r r r $ s- � � � � � �+� +�1� 1� 1� 1� 1r r c �J � e Zd ZdZd� Zd� Zd� Zd� Zd� Zd� Z dd �Z
d
� Zd� ZdS )
�DbDocz�Represents a generic document in JSON format.
Args:
value (object): The value can be a JSON string or a dict.
Raises:
ValueError: If ``value`` type is not a basestring or dict.
c �� � t |t � � r || _ d S t |t � � rt j |� � | _ d S t
dt |� � � �� � �)NzUnable to handle type: )�
isinstance�dict�__dict__�strr
�loads�
ValueError�type)r
�values r �__init__zDbDoc.__init__9 se � ��e�T�"�"� F�!�D�M�M�M�
��s�
#�
#� F� �J�u�-�-�D�M�M�M��D�t�E�{�{�D�D�E�E�Er c �* � | � � � S �N)�as_str�r
s r �__str__z
DbDoc.__str__A s � ��{�{�}�}�r c �* � t | j � � S r# )�reprr r% s r �__repr__zDbDoc.__repr__D s � ��D�M�"�"�"r c �D � |dk rt d� � �|| j |<