mirror of
https://github.com/qdrant/qdrant.git
synced 2026-08-06 01:50:57 -05:00
26 lines
708 B
Rust
26 lines
708 B
Rust
use derive_more::Into;
|
|
use pyo3::prelude::*;
|
|
use shard::operations::point_ops::*;
|
|
use shard::operations::{CollectionUpdateOperations, point_ops};
|
|
|
|
use crate::*;
|
|
|
|
#[pyclass(name = "UpdateOperation")]
|
|
#[derive(Clone, Debug, Into)]
|
|
pub struct PyUpdateOperation(CollectionUpdateOperations);
|
|
|
|
#[pymethods]
|
|
impl PyUpdateOperation {
|
|
#[staticmethod]
|
|
pub fn upsert_points(points: Vec<PyPoint>) -> Self {
|
|
let points = points.into_iter().map(Into::into).collect();
|
|
|
|
let operation =
|
|
CollectionUpdateOperations::PointOperation(point_ops::PointOperations::UpsertPoints(
|
|
PointInsertOperationsInternal::PointsList(points),
|
|
));
|
|
|
|
Self(operation)
|
|
}
|
|
}
|