Module userland.models.message.message_tags

Message tag relationship model

Classes

class MessageTags (**data)
Expand source code
class MessageTags(SQLModel, table=True):
    """Message tag model"""

    message_id: int = Field(foreign_key="message.id", primary_key=True)
    """The tagged message ID"""

    tag_name: str = Field(foreign_key="message_tag.name", primary_key=True)
    """The name of the tag"""

    __tablename__ = "message_x_message_tag"  # type: ignore

    def __init__(self, **data: Any):
        super().__init__(**data)

Message tag model

Ancestors

  • sqlmodel.main.SQLModel
  • pydantic.main.BaseModel

Class variables

var model_config

Instance variables

var message_id : int
Expand source code
def __get__(
    self, instance: Optional[object], owner: Any
) -> Union[InstrumentedAttribute[_T_co], _T_co]:
    if instance is None:
        return self

    dict_ = instance_dict(instance)
    if self.impl.supports_population and self.key in dict_:
        return dict_[self.key]  # type: ignore[no-any-return]
    else:
        try:
            state = instance_state(instance)
        except AttributeError as err:
            raise orm_exc.UnmappedInstanceError(instance) from err
        return self.impl.get(state, dict_)  # type: ignore[no-any-return]

The tagged message ID

var tag_name : str
Expand source code
def __get__(
    self, instance: Optional[object], owner: Any
) -> Union[InstrumentedAttribute[_T_co], _T_co]:
    if instance is None:
        return self

    dict_ = instance_dict(instance)
    if self.impl.supports_population and self.key in dict_:
        return dict_[self.key]  # type: ignore[no-any-return]
    else:
        try:
            state = instance_state(instance)
        except AttributeError as err:
            raise orm_exc.UnmappedInstanceError(instance) from err
        return self.impl.get(state, dict_)  # type: ignore[no-any-return]

The name of the tag