File: //lib/python3/dist-packages/boto/dynamodb2/__pycache__/fields.cpython-312.pyc
�
ckF[d � � � d dl mZ G d� de� Z G d� de� Z G d� de� Z G d� d e� Z G d
� de� Z G d� d
e� Z G d� de� Z G d� de� Z
G d� de
� Z G d� de
� Z G d� de
e � Z
y)� )�STRINGc �* � e Zd ZdZdZefd�Zd� Zd� Zy)�BaseSchemaFieldz�
An abstract class for defining schema fields.
Contains most of the core functionality for the field. Subclasses must
define an ``attr_type`` to pass to DynamoDB.
Nc � � || _ || _ y)aN
Creates a Python schema field, to represent the data to pass to
DynamoDB.
Requires a ``name`` parameter, which should be a string name of the
field.
Optionally accepts a ``data_type`` parameter, which should be a
constant from ``boto.dynamodb2.types``. (Default: ``STRING``)
N��name� data_type)�selfr r s �7/usr/lib/python3/dist-packages/boto/dynamodb2/fields.py�__init__zBaseSchemaField.__init__
s � � �� �"��� c �4 � | j | j d�S )z�
Returns the attribute definition structure DynamoDB expects.
Example::
>>> field.definition()
{
'AttributeName': 'username',
'AttributeType': 'S',
}
��
AttributeName�
AttributeTyper �r
s r �
definitionzBaseSchemaField.definition s � � "�Y�Y�!�^�^�
�
r
c �4 � | j | j d�S )z�
Returns the schema structure DynamoDB expects.
Example::
>>> field.schema()
{
'AttributeName': 'username',
'KeyType': 'HASH',
}
)r �KeyType)r � attr_typer s r �schemazBaseSchemaField.schema- s � � "�Y�Y��~�~�
�
r
) �__name__�
__module__�__qualname__�__doc__r r r r r � r
r r r s � �� �I�'-� #�
�$
r
r c � � e Zd ZdZdZy)�HashKeyz�
An field representing a hash key.
Example::
>>> from boto.dynamodb2.types import NUMBER
>>> HashKey('username')
>>> HashKey('date_joined', data_type=NUMBER)
�HASHN�r r r r r r r
r r r @ s � � � �Ir
r c � � e Zd ZdZdZy)�RangeKeyz�
An field representing a range key.
Example::
>>> from boto.dynamodb2.types import NUMBER
>>> HashKey('username')
>>> HashKey('date_joined', data_type=NUMBER)
�RANGENr r r
r r"