aether_protocol/
response.rs

1// File: src/response.rs
2// =============================================================================
3// This file defines the top-level `Response` enum. This is the single, unified
4// type that represents every possible reply the server can send to a client.
5
6use crate::types::{BatchResponse, DbStats, Record, RecordSet};
7use serde::{Deserialize, Serialize};
8
9/// The primary enum representing all possible server responses.
10#[derive(Serialize, Deserialize, Debug, PartialEq)]
11pub enum Response {
12    // --- General Responses ---
13    Success,
14    Error(String),
15
16    // --- Database Management Responses ---
17    DatabaseList(Vec<String>),
18    DatabaseCreated(bool),
19    DatabaseDropped(bool),
20
21    // --- Collection Management Responses ---
22    CollectionList(Vec<String>),
23    Stats(DbStats),
24    IndexList(Vec<String>),
25
26    // --- Record & Query Responses ---
27    Record(Option<Record>),
28    RecordSet(RecordSet),
29    RecordCount(u64),
30    RecordDeleted(bool),
31    LastInsertId(u64),
32    RecordWithRelated(Option<(Record, Record)>),
33    BatchResponse(BatchResponse),
34    RecordIdSet(Vec<String>),
35}