Commits

Kirill Simonov  committed 129c0a4

Reviewed modules `htsql_pgsql.domain` and `htsql_sqlite.domain`.

  • Participants
  • Parent commits be6e6b3

Comments (0)

Files changed (4)

File doc/api/htsql_pgsql.rst

    :members:
 .. automodule:: htsql_pgsql.export
    :members:
+.. automodule:: htsql_pgsql.domain
+   :members:
 .. automodule:: htsql_pgsql.connect
    :members:
 .. automodule:: htsql_pgsql.split_sql

File doc/api/htsql_sqlite.rst

    :members:
 .. automodule:: htsql_sqlite.export
    :members:
+.. automodule:: htsql_sqlite.domain
+   :members:
 .. automodule:: htsql_sqlite.connect
    :members:
 .. automodule:: htsql_sqlite.split_sql

File src/htsql_pgsql/domain.py

 
 
 class PGDomain(Domain):
+    """
+    Represents a PostgreSQL data type.
+
+    This is an abstract mixin class; see subclasses for concrete data types.
+
+    `schema_name` (a string)
+        The name of the type schema.
+
+    `name` (a string)
+        The name of the type.
+    """
 
     def __init__(self, schema_name, name, **attributes):
+        # Sanity check on the arguments.
+        assert isinstance(schema_name, str)
+        assert isinstance(name, str)
+
+        # Pass the attributes to the concrete domain constructor.
         super(PGDomain, self).__init__(**attributes)
         self.schema_name = schema_name
         self.name = name
 
 
 class PGBooleanDomain(PGDomain, BooleanDomain):
-    pass
+    """
+    Represents the ``BOOLEAN`` data type.
+    """
 
 
 class PGIntegerDomain(PGDomain, IntegerDomain):
-    pass
+    """
+    Represents the ``SMALLINT``, ``INTEGER`` and ``BIGINT`` data types.
+    """
 
 
 class PGFloatDomain(PGDomain, FloatDomain):
-    pass
+    """
+    Represents the ``REAL`` and ``DOUBLE PRECISION`` data types.
+    """
 
 
 class PGDecimalDomain(PGDomain, DecimalDomain):
-    pass
+    """
+    Represents the ``NUMERIC`` data type.
+    """
 
 
 class PGCharDomain(PGDomain, StringDomain):
-    pass
+    """
+    Represents the ``CHAR`` data type.
+    """
 
 
 class PGVarCharDomain(PGDomain, StringDomain):
-    pass
+    """
+    Represents the ``VARCHAR`` data type.
+    """
 
 
 class PGTextDomain(PGDomain, StringDomain):
-    pass
+    """
+    Represents the ``TEXT`` data type.
+    """
 
 
 class PGEnumDomain(PGDomain, EnumDomain):
-    pass
+    """
+    Represents the ``ENUM`` data types.
+    """
 
 
 class PGDateDomain(PGDomain, DateDomain):
-    pass
+    """
+    Represents the ``DATE`` data type.
+    """
 
 
 class PGOpaqueDomain(PGDomain, OpaqueDomain):
-    pass
+    """
+    Represents an unsupported PostgreSQL data type.
+    """
 
 

File src/htsql_sqlite/domain.py

 
 """
 :mod:`htsql_sqlite.domain`
-=========================
+==========================
 
 This module defines SQLite-specific data types.
 """
 
 
 class SQLiteDomain(Domain):
+    """
+    Represents an SQLite data type.
+
+    This is an abstract mixin class; see subclasses for concrete data types.
+
+    `name` (a string)
+        The name of the type.
+    """
 
     def __init__(self, name, **attributes):
+        # Sanity check on the arguments.
+        assert isinstance(name, str)
+
+        # Pass the attributes to the concrete domain constructor.
         super(SQLiteDomain, self).__init__(**attributes)
         self.name = name
 
 
 
 class SQLiteBooleanDomain(SQLiteDomain, BooleanDomain):
-    pass
+    """
+    Represents a pseudo-Boolean type for SQLite.
+
+    In SQL, Boolean values are expressed as integers; ``0`` is the FALSE value,
+    any non-zero integer is a TRUE value.
+    """
 
 
 class SQLiteIntegerDomain(SQLiteDomain, IntegerDomain):
-    pass
+    """
+    Represents an SQLite ``INTEGER`` data type.
+    """
 
 
 class SQLiteFloatDomain(SQLiteDomain, FloatDomain):
-    pass
+    """
+    Represents an SQLite ``REAL`` data type.
+    """
 
 
 class SQLiteTextDomain(SQLiteDomain, StringDomain):
-    pass
+    """
+    Represents an SQLite ``TEXT`` data type.
+    """
 
 
 class SQLiteDateDomain(SQLiteDomain, DateDomain):
-    pass
+    """
+    Represents a pseudo-date type for SQLite.
+
+    In SQL, values of the ``DATE`` type are represented as ``TEXT`` values
+    of the form ``YYYY-MM-DD``.
+    """
 
 
 class SQLiteOpaqueDomain(SQLiteDomain, OpaqueDomain):
-    pass
+    """
+    Represents an unsupported SQLite data type.
+    """