1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
use crateto_snake_case;
/// Converts a `&str` to a `foreign_key`
///
/// ```
/// use cruet::suffix::foreign_key::to_foreign_key;
///
/// assert!(to_foreign_key("foo_bar") == "foo_bar_id");
/// assert!(to_foreign_key("Foo bar") == "foo_bar_id");
/// assert!(to_foreign_key("Foo Bar") == "foo_bar_id");
/// assert!(to_foreign_key("Foo::Bar") == "bar_id");
/// assert!(to_foreign_key("Test::Foo::Bar") == "bar_id");
/// assert!(to_foreign_key("FooBar") == "foo_bar_id");
/// assert!(to_foreign_key("fooBar") == "foo_bar_id");
/// assert!(to_foreign_key("fooBar3") == "foo_bar_3_id");
/// ```
/// Determines if a `&str` is a `foreign_key`
///
/// ```
/// use cruet::suffix::foreign_key::is_foreign_key;
///
/// assert!(!is_foreign_key("Foo bar string that is really really long"));
/// assert!(!is_foreign_key("foo-bar-string-that-is-really-really-long"));
/// assert!(!is_foreign_key("FooBarIsAReallyReallyLongString"));
/// assert!(!is_foreign_key("Foo Bar Is A Really Really Long String"));
/// assert!(!is_foreign_key("fooBarIsAReallyReallyLongString"));
/// assert!(!is_foreign_key("foo_bar_string_that_is_really_really_long"));
/// assert!(is_foreign_key(
/// "foo_bar_string_that_is_really_really_long_id"
/// ));
/// ```