pub mod date_query;
pub mod meta_query;
pub mod orderby;
pub mod param_builder;
pub mod post_type;
pub mod tax_query;
pub mod traits;
#[cfg(feature = "php")]
mod zval;
use std::collections::HashMap;
use crate::sql::{SqlCompareOperator, SqlOrder, SqlSearchOperators};
use crate::wp_post::post_status::PostStatus;
use self::date_query::DateQuery;
use self::meta_query::{MetaQuery, MetaRelation};
use self::orderby::WpOrderBy;
use self::post_type::PostType;
use self::tax_query::{TaxQuery, TaxRelation};
#[allow(non_snake_case)]
#[derive(Debug)]
pub struct Params<'a> {
pub author: Option<u64>,
pub author_name: Option<&'a str>,
pub author__in: Option<Vec<u64>>,
pub author__not_in: Option<Vec<u64>>,
pub term_and: Option<Vec<u64>>,
pub term_in: Option<Vec<u64>>,
pub term_not_in: Option<Vec<u64>>,
pub term_slug_and: Option<Vec<&'a str>>,
pub term_slug_in: Option<Vec<&'a str>>,
pub tax_query: Option<HashMap<TaxRelation, Vec<TaxQuery<'a>>>>,
pub s: Option<&'a str>,
pub p: Option<u64>,
pub name: Option<&'a str>,
pub page_id: Option<u64>,
pub pagename: Option<&'a str>,
pub post_parent: Option<u64>,
pub post_parent__in: Option<Vec<u64>>,
pub post_parent__not_in: Option<Vec<u64>>,
pub post__in: Option<Vec<u64>>,
pub post__not_in: Option<Vec<u64>>,
pub post_name__in: Option<Vec<&'a str>>,
pub post_password: Option<&'a str>,
pub post_type: Option<Vec<PostType<'a>>>,
pub post_status: Option<PostStatus>,
pub comment_count: Option<u64>,
pub posts_per_page: Option<u64>,
pub page: Option<u64>,
pub ignore_sticky_posts: Option<bool>,
pub order: Option<SqlOrder>,
pub orderby: Option<WpOrderBy>,
pub year: Option<u16>,
pub monthnum: Option<u8>,
pub w: Option<u8>,
pub day: Option<u8>,
pub hour: Option<u8>,
pub minute: Option<u8>,
pub second: Option<u8>,
pub m: Option<u64>,
pub date_query: Option<Vec<DateQuery>>,
pub meta_key: Option<&'a str>,
pub meta_value: Option<String>,
pub meta_value_num: Option<i64>,
pub meta_compare: Option<SqlSearchOperators>,
pub meta_query: Option<HashMap<MetaRelation, Vec<MetaQuery>>>,
pub post_mime_type: Option<&'a str>,
}
impl<'a> Params<'a> {
pub fn new() -> Self {
Self {
author: None,
author_name: None,
author__in: None,
author__not_in: None,
term_and: None,
term_in: None,
term_not_in: None,
term_slug_and: None,
term_slug_in: None,
tax_query: None,
s: None,
p: None,
name: None,
page_id: None,
pagename: None,
post_parent: None,
post_parent__in: None,
post_parent__not_in: None,
post__in: None,
post__not_in: None,
post_name__in: None,
post_password: None,
post_type: None,
post_status: None,
comment_count: None,
posts_per_page: None,
page: None,
ignore_sticky_posts: None,
order: None,
orderby: None,
year: None,
monthnum: None,
w: None,
day: None,
hour: None,
minute: None,
second: None,
m: None,
date_query: None,
meta_key: None,
meta_value: None,
meta_value_num: None,
meta_compare: None,
meta_query: None,
post_mime_type: None,
}
}
}
#[derive(Debug)]
pub struct CommentCount {
pub value: u64,
pub compare: SqlCompareOperator,
}
#[cfg(test)]
mod tests {}