Coverage for functions \ flipdare \ search \ core \ query_by.py: 100%
14 statements
« prev ^ index » next coverage.py v7.13.0, created at 2026-05-08 12:22 +1000
« prev ^ index » next coverage.py v7.13.0, created at 2026-05-08 12:22 +1000
1#!/usr/bin/env python
2# Copyright (c) 2026 Flipdare Pty Ltd. All rights reserved.
3#
4# This file is part of Flipdare's proprietary software and contains
5# confidential and copyrighted material. Unauthorised copying,
6# modification, distribution, or use of this file is strictly
7# prohibited without prior written permission from Flipdare Pty Ltd.
8#
9# This software includes third-party components licensed under MIT,
10# BSD, and Apache 2.0 licences. See THIRD_PARTY_NOTICES for details.
11#
14from enum import StrEnum
16from flipdare.generated.schema.search.friend_document_schema import FriendDocumentKey
17from flipdare.generated.schema.search.general_document_schema import GeneralDocumentKey
20class QueryBy[T: StrEnum]:
21 def __init__(self, value: T | list[T]) -> None:
22 self.value = value
24 def create(self) -> str:
25 if isinstance(self.value, list):
26 return ",".join(item.value for item in self.value)
27 return self.value.value
30class GeneralQueryBy(QueryBy[GeneralDocumentKey]):
31 pass
34class FriendQueryBy(QueryBy[FriendDocumentKey]):
35 pass