Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

Commit

Permalink
Merge pull request #8 from tophat/rename
Browse files Browse the repository at this point in the history
feat: Rename PostgresJSONB to JSONB and PostgresUUID to UUID
  • Loading branch information
etimberg authored Nov 15, 2021
2 parents e1a8fb2 + f9e8f0b commit 6c33006
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ python -m pip install ormar-postgres-extensions

### Fields

Two native PG fields are provided. The `PostgresJSONB` and `PostgresUUID` types map to native `JSONB` and `UUID` data types respectively. Using these in an Ormar model is as simple as importing the fields and using them in the model.
Two native PG fields are provided. The `JSONB` and `UUID` types map to native `JSONB` and `UUID` data types respectively. Using these in an Ormar model is as simple as importing the fields and using them in the model.

```python
from uuid import UUID
Expand Down
4 changes: 2 additions & 2 deletions src/ormar_postgres_extensions/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from .fields import ( # noqa: F401
PostgresJSONB,
PostgresUUID,
JSONB,
UUID,
)
4 changes: 2 additions & 2 deletions src/ormar_postgres_extensions/fields/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
from .jsonb import PostgresJSONB # noqa: F401
from .uuid import PostgresUUID # noqa: F401
from .jsonb import JSONB # noqa: F401
from .uuid import UUID # noqa: F401
2 changes: 1 addition & 1 deletion src/ormar_postgres_extensions/fields/jsonb.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class PostgresJSONBTypeDecorator(TypeDecorator):
impl = postgresql.JSONB


class PostgresJSONB(ormar.JSON):
class JSONB(ormar.JSON):
"""
Custom JSON field uses a native PG JSONB type
"""
Expand Down
2 changes: 1 addition & 1 deletion src/ormar_postgres_extensions/fields/uuid.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def process_result_value(
return value


class PostgresUUID(ormar.UUID):
class UUID(ormar.UUID):
"""
Custom UUID field for the schema that uses a native PG UUID type
"""
Expand Down
6 changes: 3 additions & 3 deletions tests/fields/test_jsonb.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import ormar
import pytest

from ormar_postgres_extensions.fields import PostgresJSONB
from ormar_postgres_extensions.fields import JSONB
from tests.database import (
database,
metadata,
Expand All @@ -17,7 +17,7 @@ class Meta:
metadata = metadata

id: int = ormar.Integer(primary_key=True)
data: dict = PostgresJSONB()
data: dict = JSONB()


class NullableJSONBTestModel(ormar.Model):
Expand All @@ -26,7 +26,7 @@ class Meta:
metadata = metadata

id: int = ormar.Integer(primary_key=True)
data: Optional[dict] = PostgresJSONB(nullable=True)
data: Optional[dict] = JSONB(nullable=True)


@pytest.mark.asyncio
Expand Down
6 changes: 3 additions & 3 deletions tests/fields/test_uuid.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import ormar
import pytest

from ormar_postgres_extensions.fields import PostgresUUID
from ormar_postgres_extensions.fields import UUID as UUIDField
from tests.database import (
database,
metadata,
Expand All @@ -20,7 +20,7 @@ class Meta:
metadata = metadata

id: int = ormar.Integer(primary_key=True)
uid: UUID = PostgresUUID(default=uuid4)
uid: UUID = UUIDField(default=uuid4)


class NullableUUIDTestModel(ormar.Model):
Expand All @@ -29,7 +29,7 @@ class Meta:
metadata = metadata

id: int = ormar.Integer(primary_key=True)
uid: Optional[UUID] = PostgresUUID(nullable=True)
uid: Optional[UUID] = UUIDField(nullable=True)


@pytest.mark.asyncio
Expand Down

0 comments on commit 6c33006

Please sign in to comment.