Skip to content

TypeDAL 3.1

Latest
Compare
Choose a tag to compare
@robinvandernoord robinvandernoord released this 16 Apr 19:42
· 46 commits to master since this release
44bce94

TypeDAL 3.1 Release - Introducing Mixins 🥣!

We're thrilled to announce the release of TypeDAL 3.1, packed with a powerful new feature: Mixins. 🎉

Mixins Overview

Mixins in TypeDAL enable you to encapsulate reusable fields and behaviors, enhancing the flexibility and modularity of your database models.

🔗 Learn more about Mixins

Key Highlights

This update ships with two example mixins:

  • TimestampsMixin: Automate timestamp management with created_at and updated_at fields.
  • SlugMixin: Generate SEO-friendly slugs for your models, effortlessly.

Example Usage:

from typedal import TypeDAL, TypedTable
from typedal.mixins import TimestampsMixin

class MyTable(TypedTable, TimestampsMixin):
    # Define your table fields here
    pass
from typedal import TypeDAL, TypedTable
from typedal.mixins import SlugMixin

class MyTable(TypedTable, SlugMixin, slug_field="title"):
    title: str
    # Define other fields here

Creating Custom Mixins:

  • Define your own mixins to tailor functionality according to your app's requirements.
  • Enjoy seamless integration with your models, promoting code reuse and maintainability.
from typedal import TypeDAL, TypedTable
from typedal.mixins import Mixin

# Define your custom mixin
class HasImageMixin(Mixin):
    # Define your mixin fields and methods here

# Integrate custom mixin into your table definitions
class Article(TypedTable, HasImageMixin):
    # Define other fields here

Upgrade to TypeDAL 3.1 today and unlock the power of Mixins in your database modeling journey! 🚀