junobuild_collections/
msg.rs

1use crate::errors::{
2    JUNO_COLLECTIONS_ERROR_COLLECTION_NOT_EMPTY, JUNO_COLLECTIONS_ERROR_COLLECTION_NOT_FOUND,
3};
4use crate::types::core::CollectionKey;
5
6pub fn msg_db_collection_not_empty(collection: &CollectionKey) -> String {
7    msg_collection_not_empty(collection, &"Datastore".to_string())
8}
9
10pub fn msg_storage_collection_not_empty(collection: &CollectionKey) -> String {
11    msg_collection_not_empty(collection, &"Storage".to_string())
12}
13
14fn msg_collection_not_empty(collection: &CollectionKey, name: &String) -> String {
15    format!(
16        r#"{} ({} - {})"#,
17        JUNO_COLLECTIONS_ERROR_COLLECTION_NOT_EMPTY, name, collection,
18    )
19}
20
21pub fn msg_db_collection_not_found(collection: &CollectionKey) -> String {
22    msg_collection_not_found(collection, &"Datastore".to_string())
23}
24
25pub fn msg_storage_collection_not_found(collection: &CollectionKey) -> String {
26    msg_collection_not_found(collection, &"Storage".to_string())
27}
28
29fn msg_collection_not_found(collection: &CollectionKey, name: &String) -> String {
30    format!(
31        r#"{} ({} - {})"#,
32        JUNO_COLLECTIONS_ERROR_COLLECTION_NOT_FOUND, name, collection
33    )
34}