Files
fluid/backend-rust/step1-json-api/src/model.rs

32 lines
736 B
Rust
Raw Normal View History

2019-08-15 15:02:52 +03:00
use log;
2019-08-16 17:24:18 +03:00
use crate::errors::AppResult;
2019-08-15 15:02:52 +03:00
pub fn create_scheme() -> AppResult<()> {
Ok(log::info!("creating scheme"))
}
2019-08-16 19:47:38 +03:00
pub fn add_post(message: String, username: String) -> AppResult<()> {
Ok(log::info!("add post {} {}", message, username))
2019-08-15 15:02:52 +03:00
}
2019-08-18 16:22:15 +03:00
pub fn get_all_posts(offset: u32, count: u32) -> AppResult<String> {
2019-08-19 10:56:18 +03:00
log::info!("get all posts {} {}", offset, count);
2019-08-15 15:02:52 +03:00
Ok("[]".to_string())
}
2019-08-18 16:22:15 +03:00
pub fn get_posts_by_username(username: String, offset: u32, count: u32) -> AppResult<String> {
2019-08-19 10:56:18 +03:00
log::info!(
"get all posts by username {} {} {}",
username,
offset,
count
);
2019-08-15 15:02:52 +03:00
Ok("[]".to_string())
}
pub fn get_posts_count() -> AppResult<i32> {
log::info!("get posts count");
Ok(0)
}