• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

geo-engine / geoengine / 12985123830

27 Jan 2025 08:45AM UTC coverage: 90.03% (-0.07%) from 90.097%
12985123830

Pull #1011

github

web-flow
Merge e2b187685 into ef1edce10
Pull Request #1011: update to rust 1.84

22 of 27 new or added lines in 13 files covered. (81.48%)

103 existing lines in 42 files now uncovered.

125586 of 139494 relevant lines covered (90.03%)

57703.25 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

85.71
/operators/src/source/gdal_source/db_types.rs
1
use super::{
2
    FileNotFoundHandling, GdalDatasetGeoTransform, GdalDatasetParameters, GdalMetaDataRegular,
3
    GdalMetadataMapping, GdalMetadataNetCdfCf, GdalRetryOptions, GdalSourceTimePlaceholder,
4
};
5
use crate::{engine::RasterResultDescriptor, error::Error};
6
use geoengine_datatypes::{
7
    delegate_from_to_sql,
8
    primitives::{CacheTtlSeconds, TimeInstance, TimeInterval, TimeStep},
9
    util::StringPair,
10
};
11
use postgres_types::{FromSql, ToSql};
12

UNCOV
13
#[derive(Debug, ToSql, FromSql)]
×
14
#[postgres(name = "GdalDatasetParameters")]
15
pub struct GdalDatasetParametersDbType {
16
    pub file_path: String,
17
    pub rasterband_channel: i64,
18
    pub geo_transform: GdalDatasetGeoTransform,
19
    pub width: i64,
20
    pub height: i64,
21
    pub file_not_found_handling: FileNotFoundHandling,
22
    pub no_data_value: Option<f64>,
23
    pub properties_mapping: Option<Vec<GdalMetadataMapping>>,
24
    pub gdal_open_options: Option<Vec<String>>,
25
    pub gdal_config_options: Option<Vec<StringPair>>,
26
    pub allow_alphaband_as_mask: bool,
27
    pub retry: Option<GdalRetryOptions>,
28
}
29

30
impl From<&GdalDatasetParameters> for GdalDatasetParametersDbType {
31
    fn from(other: &GdalDatasetParameters) -> Self {
807✔
32
        Self {
807✔
33
            file_path: other.file_path.to_string_lossy().to_string(),
807✔
34
            rasterband_channel: other.rasterband_channel as i64,
807✔
35
            geo_transform: other.geo_transform,
807✔
36
            width: other.width as i64,
807✔
37
            height: other.height as i64,
807✔
38
            file_not_found_handling: other.file_not_found_handling,
807✔
39
            no_data_value: other.no_data_value,
807✔
40
            properties_mapping: other.properties_mapping.clone(),
807✔
41
            gdal_open_options: other.gdal_open_options.clone(),
807✔
42
            gdal_config_options: other
807✔
43
                .gdal_config_options
807✔
44
                .clone()
807✔
45
                .map(|v| v.into_iter().map(Into::into).collect()),
807✔
46
            allow_alphaband_as_mask: other.allow_alphaband_as_mask,
807✔
47
            retry: other.retry,
807✔
48
        }
807✔
49
    }
807✔
50
}
51

52
impl TryFrom<GdalDatasetParametersDbType> for GdalDatasetParameters {
53
    type Error = Error;
54

55
    fn try_from(other: GdalDatasetParametersDbType) -> Result<Self, Self::Error> {
44✔
56
        Ok(Self {
44✔
57
            file_path: other.file_path.into(),
44✔
58
            rasterband_channel: other.rasterband_channel as usize,
44✔
59
            geo_transform: other.geo_transform,
44✔
60
            width: other.width as usize,
44✔
61
            height: other.height as usize,
44✔
62
            file_not_found_handling: other.file_not_found_handling,
44✔
63
            no_data_value: other.no_data_value,
44✔
64
            properties_mapping: other.properties_mapping,
44✔
65
            gdal_open_options: other.gdal_open_options,
44✔
66
            gdal_config_options: other
44✔
67
                .gdal_config_options
44✔
68
                .map(|v| v.into_iter().map(Into::into).collect()),
44✔
69
            allow_alphaband_as_mask: other.allow_alphaband_as_mask,
44✔
70
            retry: other.retry,
44✔
71
        })
44✔
72
    }
44✔
73
}
74

UNCOV
75
#[derive(Debug, FromSql, ToSql)]
×
76
#[postgres(name = "GdalRetryOptions")]
77
pub struct GdalRetryOptionsDbType {
78
    pub max_retries: i64,
79
}
80

81
impl From<&GdalRetryOptions> for GdalRetryOptionsDbType {
82
    fn from(other: &GdalRetryOptions) -> Self {
×
83
        Self {
×
84
            max_retries: other.max_retries as i64,
×
85
        }
×
86
    }
×
87
}
88

89
impl TryFrom<GdalRetryOptionsDbType> for GdalRetryOptions {
90
    type Error = Error;
91

92
    fn try_from(other: GdalRetryOptionsDbType) -> Result<Self, Self::Error> {
×
93
        Ok(Self {
×
94
            max_retries: other.max_retries as usize,
×
95
        })
×
96
    }
×
97
}
98

UNCOV
99
#[derive(Debug, ToSql, FromSql, PartialEq)]
×
100
pub struct TextGdalSourceTimePlaceholderKeyValue {
101
    pub key: String,
102
    pub value: GdalSourceTimePlaceholder,
103
}
104

UNCOV
105
#[derive(Debug, ToSql, FromSql)]
×
106
#[postgres(name = "GdalMetaDataRegular")]
107
pub struct GdalMetaDataRegularDbType {
108
    pub result_descriptor: RasterResultDescriptor,
109
    pub params: GdalDatasetParameters,
110
    pub time_placeholders: Vec<TextGdalSourceTimePlaceholderKeyValue>,
111
    pub data_time: TimeInterval,
112
    pub step: TimeStep,
113
    pub cache_ttl: CacheTtlSeconds,
114
}
115

116
impl From<&GdalMetaDataRegular> for GdalMetaDataRegularDbType {
117
    fn from(other: &GdalMetaDataRegular) -> Self {
60✔
118
        Self {
60✔
119
            result_descriptor: other.result_descriptor.clone(),
60✔
120
            params: other.params.clone(),
60✔
121
            time_placeholders: other
60✔
122
                .time_placeholders
60✔
123
                .iter()
60✔
124
                .map(|(key, value)| TextGdalSourceTimePlaceholderKeyValue {
60✔
125
                    key: key.clone(),
57✔
126
                    value: value.clone(),
57✔
127
                })
60✔
128
                .collect(),
60✔
129
            data_time: other.data_time,
60✔
130
            step: other.step,
60✔
131
            cache_ttl: other.cache_ttl,
60✔
132
        }
60✔
133
    }
60✔
134
}
135

136
impl TryFrom<GdalMetaDataRegularDbType> for GdalMetaDataRegular {
137
    type Error = Error;
138

139
    fn try_from(other: GdalMetaDataRegularDbType) -> Result<Self, Self::Error> {
23✔
140
        Ok(Self {
23✔
141
            result_descriptor: other.result_descriptor,
23✔
142
            params: other.params,
23✔
143
            time_placeholders: other
23✔
144
                .time_placeholders
23✔
145
                .iter()
23✔
146
                .map(|item| (item.key.clone(), item.value.clone()))
23✔
147
                .collect(),
23✔
148
            data_time: other.data_time,
23✔
149
            step: other.step,
23✔
150
            cache_ttl: other.cache_ttl,
23✔
151
        })
23✔
152
    }
23✔
153
}
154

UNCOV
155
#[derive(Debug, ToSql, FromSql)]
×
156
#[postgres(name = "GdalMetadataNetCdfCf")]
157
pub struct GdalMetadataNetCdfCfDbType {
158
    pub result_descriptor: RasterResultDescriptor,
159
    pub params: GdalDatasetParameters,
160
    pub start: TimeInstance,
161
    pub end: TimeInstance,
162
    pub step: TimeStep,
163
    pub band_offset: i64,
164
    pub cache_ttl: CacheTtlSeconds,
165
}
166

167
impl From<&GdalMetadataNetCdfCf> for GdalMetadataNetCdfCfDbType {
168
    fn from(other: &GdalMetadataNetCdfCf) -> Self {
1✔
169
        Self {
1✔
170
            result_descriptor: other.result_descriptor.clone(),
1✔
171
            params: other.params.clone(),
1✔
172
            start: other.start,
1✔
173
            end: other.end,
1✔
174
            step: other.step,
1✔
175
            band_offset: other.band_offset as i64,
1✔
176
            cache_ttl: other.cache_ttl,
1✔
177
        }
1✔
178
    }
1✔
179
}
180

181
impl TryFrom<GdalMetadataNetCdfCfDbType> for GdalMetadataNetCdfCf {
182
    type Error = Error;
183

184
    fn try_from(other: GdalMetadataNetCdfCfDbType) -> Result<Self, Self::Error> {
1✔
185
        Ok(Self {
1✔
186
            result_descriptor: other.result_descriptor,
1✔
187
            params: other.params,
1✔
188
            start: other.start,
1✔
189
            end: other.end,
1✔
190
            step: other.step,
1✔
191
            band_offset: other.band_offset as usize,
1✔
192
            cache_ttl: other.cache_ttl,
1✔
193
        })
1✔
194
    }
1✔
195
}
196

197
delegate_from_to_sql!(GdalDatasetParameters, GdalDatasetParametersDbType);
198
delegate_from_to_sql!(GdalMetadataNetCdfCf, GdalMetadataNetCdfCfDbType);
199
delegate_from_to_sql!(GdalMetaDataRegular, GdalMetaDataRegularDbType);
200
delegate_from_to_sql!(GdalRetryOptions, GdalRetryOptionsDbType);
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc