Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/darkskygit/gchdb
Provides a record abstraction for storing chat records extracted by different chat software, and provides full-text search feature
https://github.com/darkskygit/gchdb
database full-text-search recorder
Last synced: 16 days ago
JSON representation
Provides a record abstraction for storing chat records extracted by different chat software, and provides full-text search feature
- Host: GitHub
- URL: https://github.com/darkskygit/gchdb
- Owner: darkskygit
- License: agpl-3.0
- Created: 2020-05-14T13:31:36.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-11-03T11:23:58.000Z (2 months ago)
- Last Synced: 2024-12-17T02:57:04.288Z (19 days ago)
- Topics: database, full-text-search, recorder
- Language: Rust
- Homepage:
- Size: 178 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# GCHDB aka General chat history database
This crate provides chat record abstraction, used to store chat records extracted from different chat software, and integrated Chinese full-text index.
# Usage
```rust
fn main() -> ChatRecordResult<()> {
// create an records database
let mut recoder = SqliteChatRecorder::new("record.db")?;
// create record, you can extract some record from other im's database
let record = Record {
chat_type: "testaasdavxz".into(),
owner_id: "asdasdasdaaaa".into(),
group_id: "asdasdasd".into(),
sender: "人民日报".into(),
content:
"张华考上了北京大学;李萍进了中等技术学校;我在百货公司当售货员:我们都有光明的前途"
.into(),
timestamp: chrono::Local::now().naive_utc().timestamp_millis(),
..Default::default()
};
// insert to database
assert_eq!(recoder.insert_or_update_record(&record)?, true);
// index the contents of the record
recoder.refresh_index()?;
// query record by sql
println!(
"{:?}",
recoder.get_record(Query {
chat_type: Some("testaasdavxz".into()),
sender: Some("%日报".into()),
..Default::default()
})?
);
// query record by indexer
println!(
"{:?}",
recoder.get_record(Query {
keyword: Some("技术学校".into()),
..Default::default()
})?
);
// remove record in database
assert_eq!(recoder.remove_record(record)?, true);
Ok(())
}
```# Contributing
Welcome pull request :)
# License
AGPL3.0