diff --git a/python/zvec/model/collection.py b/python/zvec/model/collection.py index ec4d6305..eee571d8 100644 --- a/python/zvec/model/collection.py +++ b/python/zvec/model/collection.py @@ -13,7 +13,7 @@ # limitations under the License. from __future__ import annotations -from typing import Optional, Union +from typing import Optional, Union, overload from _zvec import _Collection @@ -230,6 +230,14 @@ def alter_column( self._schema = CollectionSchema._from_core(self._obj.Schema()) # ========== Collection DDL Methods ========== + @overload + def insert(self, docs: Doc) -> Status: + pass + + @overload + def insert(self, docs: list[Doc]) -> list[Status]: + pass + def insert(self, docs: Union[Doc, list[Doc]]) -> Union[Status, list[Status]]: """Insert new documents into the collection. @@ -249,6 +257,14 @@ def insert(self, docs: Union[Doc, list[Doc]]) -> Union[Status, list[Status]]: ) return results[0] if is_single else results + @overload + def upsert(self, docs: Doc) -> Status: + pass + + @overload + def upsert(self, docs: list[Doc]) -> list[Status]: + pass + def upsert(self, docs: Union[Doc, list[Doc]]) -> Union[Status, list[Status]]: """Insert new documents or update existing ones by ID. @@ -266,6 +282,14 @@ def upsert(self, docs: Union[Doc, list[Doc]]) -> Union[Status, list[Status]]: ) return results[0] if is_single else results + @overload + def update(self, docs: Doc) -> Status: + pass + + @overload + def update(self, docs: list[Doc]) -> list[Status]: + pass + def update(self, docs: Union[Doc, list[Doc]]) -> Union[Status, list[Status]]: """Update existing documents by ID. @@ -285,6 +309,14 @@ def update(self, docs: Union[Doc, list[Doc]]) -> Union[Status, list[Status]]: ) return results[0] if is_single else results + @overload + def delete(self, ids: str) -> Status: + pass + + @overload + def delete(self, ids: list[str]) -> list[Status]: + pass + def delete(self, ids: Union[str, list[str]]) -> Union[Status, list[Status]]: """Delete documents by ID.