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!(r#"{JUNO_COLLECTIONS_ERROR_COLLECTION_NOT_EMPTY} ({name} - {collection})"#,)
16}
17
18pub fn msg_db_collection_not_found(collection: &CollectionKey) -> String {
19    msg_collection_not_found(collection, &"Datastore".to_string())
20}
21
22pub fn msg_storage_collection_not_found(collection: &CollectionKey) -> String {
23    msg_collection_not_found(collection, &"Storage".to_string())
24}
25
26fn msg_collection_not_found(collection: &CollectionKey, name: &String) -> String {
27    format!(r#"{JUNO_COLLECTIONS_ERROR_COLLECTION_NOT_FOUND} ({name} - {collection})"#)
28}