new form page row2 from id

This commit is contained in:
Filipriec
2026-08-22 11:14:54 +02:00
parent 2d850b12ca
commit 0c8a1b1c19
5 changed files with 167 additions and 20 deletions

View File

@@ -387,7 +387,7 @@ pub struct GetTableDataCountRequest {
#[prost(string, tag = "2")]
pub table_name: ::prost::alloc::string::String,
}
/// Fetch the last visible row and the exact number of visible rows.
/// Fetch the last visible row by stable row id.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GetLastTableDataRequest {
#[prost(string, tag = "1")]
@@ -397,12 +397,30 @@ pub struct GetLastTableDataRequest {
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetLastTableDataResponse {
/// Zero when the table has no visible rows.
#[prost(int64, tag = "1")]
pub total_count: i64,
/// Absent when total_count is zero.
pub last_id: i64,
/// Absent when last_id is zero.
#[prost(message, optional, tag = "2")]
pub row: ::core::option::Option<GetTableDataResponse>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GetAdjacentTableDataRequest {
#[prost(string, tag = "1")]
pub profile_name: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub table_name: ::prost::alloc::string::String,
#[prost(int64, tag = "3")]
pub anchor_id: i64,
#[prost(enumeration = "RowIdDirection", tag = "4")]
pub direction: i32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetAdjacentTableDataResponse {
/// Absent when no visible row exists in the requested direction.
#[prost(message, optional, tag = "1")]
pub row: ::core::option::Option<GetTableDataResponse>,
}
/// Fetch by ordinal position among non-deleted rows (1-based).
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GetTableDataByPositionRequest {
@@ -456,6 +474,32 @@ impl ResolvedTableLinkStatus {
}
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum RowIdDirection {
Next = 0,
Previous = 1,
}
impl RowIdDirection {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Next => "ROW_ID_DIRECTION_NEXT",
Self::Previous => "ROW_ID_DIRECTION_PREVIOUS",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"ROW_ID_DIRECTION_NEXT" => Some(Self::Next),
"ROW_ID_DIRECTION_PREVIOUS" => Some(Self::Previous),
_ => None,
}
}
}
/// Generated client implementations.
pub mod tables_data_client {
#![allow(
@@ -1034,10 +1078,8 @@ pub mod tables_data_client {
);
self.inner.unary(req, path, codec).await
}
/// Fetch the last non-deleted row by id together with the exact row count.
/// This is the efficient form-opening path: unlike GetTableDataByPosition at
/// the final position, it does not walk the table through a large OFFSET, and
/// it avoids a separate client/server round trip for the count.
/// Fetch the last non-deleted row by id. This is the efficient form-opening
/// path and does not scan the table through OFFSET or COUNT(\*).
pub async fn get_last_table_data(
&mut self,
request: impl tonic::IntoRequest<super::GetLastTableDataRequest>,
@@ -1064,6 +1106,37 @@ pub mod tables_data_client {
);
self.inner.unary(req, path, codec).await
}
/// Fetch the nearest visible row before or after an existing row id. This is
/// the ordinary form-navigation path and skips deleted/id-gap rows.
pub async fn get_adjacent_table_data(
&mut self,
request: impl tonic::IntoRequest<super::GetAdjacentTableDataRequest>,
) -> std::result::Result<
tonic::Response<super::GetAdjacentTableDataResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/komp_ac.tables_data.TablesData/GetAdjacentTableData",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"komp_ac.tables_data.TablesData",
"GetAdjacentTableData",
),
);
self.inner.unary(req, path, codec).await
}
/// Fetch the N-th non-deleted row by id order (1-based), then return its full data.
///
/// Behavior:
@@ -1282,10 +1355,8 @@ pub mod tables_data_server {
tonic::Response<super::super::common::CountResponse>,
tonic::Status,
>;
/// Fetch the last non-deleted row by id together with the exact row count.
/// This is the efficient form-opening path: unlike GetTableDataByPosition at
/// the final position, it does not walk the table through a large OFFSET, and
/// it avoids a separate client/server round trip for the count.
/// Fetch the last non-deleted row by id. This is the efficient form-opening
/// path and does not scan the table through OFFSET or COUNT(\*).
async fn get_last_table_data(
&self,
request: tonic::Request<super::GetLastTableDataRequest>,
@@ -1293,6 +1364,15 @@ pub mod tables_data_server {
tonic::Response<super::GetLastTableDataResponse>,
tonic::Status,
>;
/// Fetch the nearest visible row before or after an existing row id. This is
/// the ordinary form-navigation path and skips deleted/id-gap rows.
async fn get_adjacent_table_data(
&self,
request: tonic::Request<super::GetAdjacentTableDataRequest>,
) -> std::result::Result<
tonic::Response<super::GetAdjacentTableDataResponse>,
tonic::Status,
>;
/// Fetch the N-th non-deleted row by id order (1-based), then return its full data.
///
/// Behavior:
@@ -2128,6 +2208,52 @@ pub mod tables_data_server {
};
Box::pin(fut)
}
"/komp_ac.tables_data.TablesData/GetAdjacentTableData" => {
#[allow(non_camel_case_types)]
struct GetAdjacentTableDataSvc<T: TablesData>(pub Arc<T>);
impl<
T: TablesData,
> tonic::server::UnaryService<super::GetAdjacentTableDataRequest>
for GetAdjacentTableDataSvc<T> {
type Response = super::GetAdjacentTableDataResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::GetAdjacentTableDataRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as TablesData>::get_adjacent_table_data(&inner, request)
.await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = GetAdjacentTableDataSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/komp_ac.tables_data.TablesData/GetTableDataByPosition" => {
#[allow(non_camel_case_types)]
struct GetTableDataByPositionSvc<T: TablesData>(pub Arc<T>);