zero_mysql/protocol/trait/
mod.rs1pub mod param;
2
3use crate::error::Result;
4use crate::protocol::command::ColumnDefinition;
5use crate::protocol::response::OkPayloadBytes;
6use crate::protocol::{BinaryRowPayload, TextRowPayload};
7
8pub trait RowDecoder<'a> {
12 type Output;
14
15 fn decode_row(&mut self, row: BinaryRowPayload<'a>) -> Result<Self::Output>;
24}
25
26pub trait BinaryResultSetHandler {
28 fn no_result_set(&mut self, ok: OkPayloadBytes) -> Result<()>;
29 fn resultset_start(&mut self, cols: &[ColumnDefinition<'_>]) -> Result<()>;
30 fn row(&mut self, cols: &[ColumnDefinition<'_>], row: BinaryRowPayload<'_>) -> Result<()>;
31 fn resultset_end(&mut self, eof: OkPayloadBytes) -> Result<()>;
32}
33
34pub trait TextResultSetHandler {
36 fn no_result_set(&mut self, ok: OkPayloadBytes) -> Result<()>;
37 fn resultset_start(&mut self, cols: &[ColumnDefinition<'_>]) -> Result<()>;
38 fn row(&mut self, cols: &[ColumnDefinition<'_>], row: TextRowPayload<'_>) -> Result<()>;
39 fn resultset_end(&mut self, eof: OkPayloadBytes) -> Result<()>;
40}
41
42#[cfg(test)]
43mod param_test;