This commit is contained in:
Hellow2 2023-03-03 12:13:23 +01:00
parent 160c5bbd66
commit ebe3d9328c
2 changed files with 8 additions and 1 deletions

View File

@ -60,7 +60,7 @@ class Collection:
if unified in self._by_attribute[name]: if unified in self._by_attribute[name]:
return self._by_attribute[name][unified] return self._by_attribute[name][unified]
def append(self, element: SourceAttribute): def append(self, element: SourceAttribute, merge_on_conflict: bool = True):
if type(element) is not self.element_type and self.element_type is not None: if type(element) is not self.element_type and self.element_type is not None:
raise TypeError(f"{type(element)} is not the set type {self.element_type}") raise TypeError(f"{type(element)} is not the set type {self.element_type}")

View File

@ -7,6 +7,9 @@ from ..utils.shared import (
class DatabaseObject: class DatabaseObject:
COLLECTION_ATTRIBUTES: tuple = tuple()
SIMPLE_ATTRIBUTES: tuple = tuple()
def __init__(self, _id: str = None, dynamic: bool = False, **kwargs) -> None: def __init__(self, _id: str = None, dynamic: bool = False, **kwargs) -> None:
if _id is None and not dynamic: if _id is None and not dynamic:
""" """
@ -21,6 +24,9 @@ class DatabaseObject:
self.dynamic = dynamic self.dynamic = dynamic
def merge(self, other, override: bool = False):
for collection in
class MainObject(DatabaseObject): class MainObject(DatabaseObject):
""" """
@ -33,6 +39,7 @@ class MainObject(DatabaseObject):
It has all the functionality of the "DatabaseObject" (it inherits from said class) It has all the functionality of the "DatabaseObject" (it inherits from said class)
but also some added functions as well. but also some added functions as well.
""" """
def __init__(self, _id: str = None, dynamic: bool = False, **kwargs): def __init__(self, _id: str = None, dynamic: bool = False, **kwargs):
super().__init__(_id=_id, dynamic=dynamic, **kwargs) super().__init__(_id=_id, dynamic=dynamic, **kwargs)