mirror of
https://github.com/mealie-recipes/mealie.git
synced 2026-05-15 22:37:32 -04:00
define PrivateColumn
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import string
|
import string
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
from typing import Annotated
|
||||||
|
|
||||||
from sqlalchemy import Integer
|
from sqlalchemy import Integer
|
||||||
from sqlalchemy.orm import DeclarativeBase, Mapped, declared_attr, mapped_column, synonym
|
from sqlalchemy.orm import DeclarativeBase, Mapped, declared_attr, mapped_column, synonym
|
||||||
@@ -13,6 +14,12 @@ from ._model_utils.datetime import NaiveDateTime, get_utc_now
|
|||||||
NORMALIZE_PUNCTUATION = string.punctuation.replace("'", "").replace('"', "")
|
NORMALIZE_PUNCTUATION = string.punctuation.replace("'", "").replace('"', "")
|
||||||
_NORMALIZE_PUNCTUATION_TABLE = str.maketrans(NORMALIZE_PUNCTUATION, " " * len(NORMALIZE_PUNCTUATION))
|
_NORMALIZE_PUNCTUATION_TABLE = str.maketrans(NORMALIZE_PUNCTUATION, " " * len(NORMALIZE_PUNCTUATION))
|
||||||
|
|
||||||
|
type PrivateColumn[T] = Mapped[Annotated[T, mapped_column(info={"private": True})]]
|
||||||
|
"""
|
||||||
|
A `Mapped` attribute with metadata `private=True`.
|
||||||
|
Signals to the query filter API not to allow using this field in query operations.
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
class SqlAlchemyBase(DeclarativeBase):
|
class SqlAlchemyBase(DeclarativeBase):
|
||||||
id: Mapped[int] = mapped_column(Integer, primary_key=True)
|
id: Mapped[int] = mapped_column(Integer, primary_key=True)
|
||||||
|
|||||||
Reference in New Issue
Block a user