Struct wicrs_server::channel::Channel [−][src]
pub struct Channel { pub id: ID, pub hub_id: ID, pub description: String, pub name: String, pub created: DateTime<Utc>, }
Text channel, used to group a manage sets of messages.
Fields
id: ID
ID of the channel.
hub_id: ID
ID of the Hub that the channel belongs to.
description: String
Description of the channel.
name: String
Name of the channel.
created: DateTime<Utc>
Date the channel was created in milliseconds since Unix Epoch.
Implementations
impl Channel
[src]
pub fn new(name: String, id: ID, hub_id: ID) -> Self
[src]
Creates a new channel object based on parameters.
pub fn get_folder(&self) -> String
[src]
Get the path of the channel’s data folder, used for storing message files.
pub async fn create_dir(&self) -> Result
[src]
Creates the channel data folder.
pub async fn add_message(&self, message: Message) -> Result
[src]
Adds a message to the channel, writes it to the file corresponding to the day the message was sent, one file per day of messages, only created if a message is sent that day.
Errors
This function will return an error in the following situations, but is not limited to just these cases:
- The message file does not exist and could not be created.
- Was unable to write to the message file.
pub async fn get_last_messages(&self, max: usize) -> Vec<Message>
[src]
Gets the last messages sent, max
indicates the maximum number of messages to return.
pub async fn get_messages(&self, ids: Vec<ID>) -> Vec<Message>
[src]
Tries to get all the messages listed by their IDs in ids
. Not guaranteed to return all or any of the wanted messages.
pub async fn get_messages_between(
&self,
from: DateTime<Utc>,
to: DateTime<Utc>,
invert: bool,
max: usize
) -> Vec<Message>
[src]
&self,
from: DateTime<Utc>,
to: DateTime<Utc>,
invert: bool,
max: usize
) -> Vec<Message>
Gets a set of messages between two times given in milliseconds since Unix Epoch.
Arguments
from
- The earliest send time a message can have to be included.to
- The latest send time a message can have to be included.invert
- If true messages are returned in order of newest to oldest if false, oldest to newest, search is also done in that order.max
- The maximum number of messages to return.
pub async fn find_messages_containing(
&self,
string: String,
case_sensitive: bool,
max: usize
) -> Vec<Message>
[src]
&self,
string: String,
case_sensitive: bool,
max: usize
) -> Vec<Message>
Search for messages that contain a string, if case_sensitive
is true than the search is case_sensitive, case sensitive search is marginally faster.
pub async fn get_messages_after(&self, id: &ID, max: usize) -> Vec<Message>
[src]
Gets all messages that were sent after the message with the given ID.
pub async fn get_all_messages_from(&self, id: &ID) -> Vec<Message>
[src]
Unlimited asynchronus version of [get_messages_after
] for internal use.
pub async fn get_message(&self, id: &ID) -> Option<Message>
[src]
Get the first message with the given ID.
pub async fn get_current_file(&self) -> String
[src]
Gets the path of the current message file, filename is time in milliseconds from Unix Epoch divided by 86400000
(the number of milliseconds in a day).
Trait Implementations
impl Clone for Channel
[src]
impl ContainerType for Channel
[src]
fn resolve_field<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
ctx: &'life1 Context<'life2>
) -> Pin<Box<dyn Future<Output = ServerResult<Option<Value>>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
ctx: &'life1 Context<'life2>
) -> Pin<Box<dyn Future<Output = ServerResult<Option<Value>>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
fn find_entity<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
ctx: &'life1 Context<'life2>,
params: &'life3 Value
) -> Pin<Box<dyn Future<Output = ServerResult<Option<Value>>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
ctx: &'life1 Context<'life2>,
params: &'life3 Value
) -> Pin<Box<dyn Future<Output = ServerResult<Option<Value>>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait,
pub fn collect_all_fields(
&'a self,
ctx: &ContextBase<'a, &'a Positioned<SelectionSet>>,
fields: &mut Fields<'a>
) -> Result<(), ServerError> where
Self: Send + Sync,
[src]
&'a self,
ctx: &ContextBase<'a, &'a Positioned<SelectionSet>>,
fields: &mut Fields<'a>
) -> Result<(), ServerError> where
Self: Send + Sync,
impl Debug for Channel
[src]
impl<'de> Deserialize<'de> for Channel
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl ObjectType for Channel
[src]
impl OutputType for Channel
[src]
fn resolve<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
ctx: &'life1 ContextSelectionSet<'life2>,
_field: &'life3 Positioned<Field>
) -> Pin<Box<dyn Future<Output = ServerResult<Value>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
ctx: &'life1 ContextSelectionSet<'life2>,
_field: &'life3 Positioned<Field>
) -> Pin<Box<dyn Future<Output = ServerResult<Value>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait,
impl Serialize for Channel
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl Type for Channel
[src]
fn type_name() -> Cow<'static, str>
[src]
fn create_type_info(registry: &mut Registry) -> String
[src]
pub fn qualified_type_name() -> String
[src]
pub fn introspection_type_name(&self) -> Cow<'static, str>
[src]
Auto Trait Implementations
impl RefUnwindSafe for Channel
impl Send for Channel
impl Sync for Channel
impl Unpin for Channel
impl UnwindSafe for Channel
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> Downcast for T where
T: Any,
T: Any,
pub fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
pub fn as_any(&self) -> &(dyn Any + 'static)
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
impl<T> DowncastSync for T where
T: Any + Send + Sync,
T: Any + Send + Sync,
impl<T> From<T> for T
[src]
impl<T> Fruit for T where
T: Send + Downcast,
[src]
T: Send + Downcast,
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> IntoResult<T> for T
[src]
type Err = Infallible
pub fn into_result(self) -> Result<T, <T as IntoResult<T>>::Err>
[src]
impl<T> Pointable for T
pub const ALIGN: usize
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
pub unsafe fn drop(ptr: usize)
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,