Metadata-Version: 2.4
Name: tileorm
Version: 0.2.0
Summary: An ORM for Tile38 inspired by Peewee - with Pydantic validation
Author: Alex Ward
Author-email: Alex Ward <alxwrd@googlemail.com>
License-Expression: MIT
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Requires-Dist: pyle38~=0.14.2
Requires-Dist: pydantic~=2.10.5
Requires-Dist: pygeohash~=3.2.2
Requires-Python: >=3.12, <4
Description-Content-Type: text/markdown

# 🌐 TileORM

[![Tests](https://github.com/happycabby-co/tileorm/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/happycabby-co/tileorm/actions/workflows/test.yml)

> [!WARNING]
> Not advisable for production critical workflows


## Getting started

```shell
pip install tileorm
```

```python
from tileorm import Model, Identifier, Group, CharField, Tile38

db = Tile38("redis://localhost:9851")

class Truck(Model):
    id: int = Identifier()
    group: str = Group()
    field: str = CharField()

    class Meta:
        database = db


truck1 = await Truck.create(
    id=1,
    group="fleet1",
    location=Point(lat=52.25, lon=13.37),
    field="value,
)

truck = Truck.get(id=1, group="fleet1") 
# Truck(id=1, location=Location(lat=52.25, lon=13.37), group='fleet1', field='value')

await db.get(truck.key, truck.id).withfields().exec()
# {'ok': True, 'object': {'type': 'Point', 'coordinates': [13.37, 52.25]}, 'fields': {'field': 'value'}, 'elapsed': '411.458µs'}
```
