File: //usr/lib/python3/dist-packages/boto/dynamodb2/__pycache__/fields.cpython-310.pyc
o
ckF[d � @ s� d dl mZ G dd� de�ZG dd� de�ZG dd� de�ZG dd � d e�ZG d
d� de�ZG dd
� d
e�ZG dd� de�Z G dd� de�Z
G dd� de
�ZG dd� de
�ZG dd� de
e �Z
dS )� )�STRINGc @ s0 e Zd ZdZdZefdd�Zdd� Zdd� ZdS ) �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 C s || _ || _dS )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 � r �7/usr/lib/python3/dist-packages/boto/dynamodb2/fields.py�__init__
s
zBaseSchemaField.__init__c C � | j | jd�S )z�
Returns the attribute definition structure DynamoDB expects.
Example::
>>> field.definition()
{
'AttributeName': 'username',
'AttributeType': 'S',
}
��
AttributeName�
AttributeTyper �r r r r �
definition � �zBaseSchemaField.definitionc C r )z�
Returns the schema structure DynamoDB expects.
Example::
>>> field.schema()
{
'AttributeName': 'username',
'KeyType': 'HASH',
}
)r
�KeyType)r � attr_typer r r r �schema- r zBaseSchemaField.schema) �__name__�
__module__�__qualname__�__doc__r r r
r r r r r r r s r c @ � e Zd ZdZdZdS )�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 @ �
r c @ r )�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 r N r r c @ s( e Zd ZdZdd� Zdd� Zdd� ZdS ) �BaseIndexFieldz�
An abstract class for defining schema indexes.
Contains most of the core functionality for the index. Subclasses must
define a ``projection_type`` to pass to DynamoDB.
c C s || _ || _d S �N)r �parts)r r r"