|
1 | 1 | //! PostgreSQL specific functions
|
2 | 2 |
|
3 | 3 | use super::expression_methods::InetOrCidr;
|
4 |
| -use crate::expression::functions::sql_function; |
| 4 | +use crate::expression::functions::sql_function_v2; |
5 | 5 | use crate::sql_types::*;
|
6 | 6 |
|
7 |
| -sql_function! { |
| 7 | +sql_function_v2! { |
8 | 8 | /// Creates an abbreviated display format as text.
|
9 | 9 | #[cfg(feature = "postgres_backend")]
|
10 | 10 | fn abbrev<T: InetOrCidr + SingleValue>(addr: T) -> Text;
|
11 | 11 | }
|
12 |
| -sql_function! { |
| 12 | +sql_function_v2! { |
13 | 13 | /// Computes the broadcast address for the address's network.
|
14 | 14 | #[cfg(feature = "postgres_backend")]
|
15 | 15 | fn broadcast<T: InetOrCidr + SingleValue>(addr: T) -> Inet;
|
16 | 16 | }
|
17 |
| -sql_function! { |
| 17 | +sql_function_v2! { |
18 | 18 | /// Returns the address's family: 4 for IPv4, 6 for IPv6.
|
19 | 19 | #[cfg(feature = "postgres_backend")]
|
20 | 20 | fn family<T: InetOrCidr + SingleValue>(addr: T) -> Integer;
|
21 | 21 | }
|
22 |
| -sql_function! { |
| 22 | +sql_function_v2! { |
23 | 23 | /// Returns the IP address as text, ignoring the netmask.
|
24 | 24 | #[cfg(feature = "postgres_backend")]
|
25 | 25 | fn host<T: InetOrCidr + SingleValue>(addr: T) -> Text;
|
26 | 26 | }
|
27 |
| -sql_function! { |
| 27 | +sql_function_v2! { |
28 | 28 | /// Computes the host mask for the address's network.
|
29 | 29 | #[cfg(feature = "postgres_backend")]
|
30 | 30 | fn hostmask<T: InetOrCidr + SingleValue>(addr: T) -> Inet;
|
31 | 31 | }
|
32 |
| -sql_function! { |
| 32 | +sql_function_v2! { |
33 | 33 | /// Computes the smallest network that includes both of the given networks.
|
34 | 34 | #[cfg(feature = "postgres_backend")]
|
35 | 35 | fn inet_merge<T: InetOrCidr + SingleValue, U: InetOrCidr + SingleValue>(a: T, b: U) -> Cidr;
|
36 | 36 | }
|
37 |
| -sql_function! { |
| 37 | +sql_function_v2! { |
38 | 38 | /// Tests whether the addresses belong to the same IP family.
|
39 | 39 | #[cfg(feature = "postgres_backend")]
|
40 | 40 | fn inet_same_family<T: InetOrCidr + SingleValue, U: InetOrCidr + SingleValue>(a: T, b: U) -> Bool;
|
41 | 41 | }
|
42 |
| -sql_function! { |
| 42 | +sql_function_v2! { |
43 | 43 | /// Returns the netmask length in bits.
|
44 | 44 | #[cfg(feature = "postgres_backend")]
|
45 | 45 | fn masklen<T: InetOrCidr + SingleValue>(addr: T) -> Integer;
|
46 | 46 | }
|
47 |
| -sql_function! { |
| 47 | +sql_function_v2! { |
48 | 48 | /// Computes the network mask for the address's network.
|
49 | 49 | #[cfg(feature = "postgres_backend")]
|
50 | 50 | fn netmask<T: InetOrCidr + SingleValue>(addr: T) -> Inet;
|
51 | 51 | }
|
52 |
| -sql_function! { |
| 52 | +sql_function_v2! { |
53 | 53 | /// Returns the network part of the address, zeroing out whatever is to the right of the
|
54 | 54 | /// netmask. (This is equivalent to casting the value to cidr.)
|
55 | 55 | #[cfg(feature = "postgres_backend")]
|
56 | 56 | fn network<T: InetOrCidr + SingleValue>(addr: T) -> Cidr;
|
57 | 57 | }
|
58 |
| -sql_function! { |
| 58 | +sql_function_v2! { |
59 | 59 | /// Sets the netmask length for an inet or cidr value.
|
60 | 60 | /// For inet, the address part does not changes. For cidr, address bits to the right of the new
|
61 | 61 | /// netmask are set to zero.
|
|
0 commit comments