Expand description
§parse-mysql-slowlog streams a slow query and returns a stream of entries from slow logs
from your FramedReader tokio input of choice.
§Example:
 use futures::StreamExt;
 use mysql_slowlog_parser::{CodecError, Entry, EntryCodec};
 use std::ops::AddAssign;
 use std::time::Instant;
 use tokio::fs::File;
 use tokio_util::codec::FramedRead;
 #[tokio::main]
 async fn main() {
 let start = Instant::now();
 let fr = FramedRead::with_capacity(
     File::open("assets/slow-test-queries.log")
     .await
     .unwrap(),
     EntryCodec::default(),
        400000,
);
    let mut i = 0;
    let future = fr.for_each(|re: Result<Entry, CodecError>| async move {
        let _ = re.unwrap();
        i.add_assign(1);
    });
    future.await;
    println!("parsed {} entries in: {}", i, start.elapsed().as_secs_f64());
}Structs§
- Entry
- a struct representing a single log entry
- EntryAdmin Command 
- admin command values parsed from sql lines of an entry
- EntryCall 
- struct containing details of how long the query took
- EntryCodec 
- struct holding contextual information used while decoding
- EntryCodec Config 
- Struct to pass along configuration values to codec
- EntryContext 
- Values parsed from a query comment, these values are currently overly-specific
- EntrySession 
- struct containing information about the connection where the query originated
- EntrySqlAttributes 
- struct with information about the Entry’s SQL query
- EntrySqlStatement Object 
- Database objects called from within a query
- EntryStats 
- struct with stats on how long a query took and number of rows examined
- SessionLine 
- values from the User: entry line ex. # User@Host: msandbox[msandbox] @ localhost [] Id: 3
- SqlStatementContext 
- Struct containing information parsed from the initial comment in a SQL query
- StatsLine 
- values parsed from stats entry line
- TimeLine 
- A struct holding a DateTimeparsed from the Time: line of the entry ex:# Time: 2018-02-05T02:46:43.015898Z
Enums§
- CodecError 
- Errors for problems when reading frames from the source
- EntryError 
- Error when building an entry
- EntryMasking 
- types of masking to apply when parsing SQL statements
- EntrySqlType 
- The SQL statement type of the EntrySqlStatement.
- EntryStatement 
- Types of possible statements parsed from the log:
- ReadError 
- Error covering problems reading or parsing a log
- ReaderBuild Error 
- errors that occur when building a Reader