@@ -37,9 +37,9 @@ pub fn insert(
3737 RETURNING {projection}
3838 "# ,
3939 table = schema:: TABLE_NAME ,
40- user_id = Columns :: UserId . as_str ( ) ,
41- element_id = Columns :: ElementId . as_str ( ) ,
42- r#type = Columns :: Type . as_str ( ) ,
40+ user_id = Columns :: UserId . as_ref ( ) ,
41+ element_id = Columns :: ElementId . as_ref ( ) ,
42+ r#type = Columns :: Type . as_ref ( ) ,
4343 projection = ElementEvent :: projection( ) ,
4444 ) ;
4545 let params = named_params ! {
@@ -66,8 +66,8 @@ pub fn select_all(
6666 "# ,
6767 projection = ElementEvent :: projection( ) ,
6868 table = schema:: TABLE_NAME ,
69- updated_at = Columns :: UpdatedAt . as_str ( ) ,
70- id = Columns :: Id . as_str ( ) ,
69+ updated_at = Columns :: UpdatedAt . as_ref ( ) ,
70+ id = Columns :: Id . as_ref ( ) ,
7171 ) ;
7272 Ok ( conn
7373 . prepare ( & sql) ?
@@ -92,9 +92,9 @@ pub fn select_by_type(
9292 "# ,
9393 projection = ElementEvent :: projection( ) ,
9494 table = schema:: TABLE_NAME ,
95- r#type = Columns :: Type . as_str ( ) ,
96- updated_at = Columns :: UpdatedAt . as_str ( ) ,
97- id = Columns :: Id . as_str ( ) ,
95+ r#type = Columns :: Type . as_ref ( ) ,
96+ updated_at = Columns :: UpdatedAt . as_ref ( ) ,
97+ id = Columns :: Id . as_ref ( ) ,
9898 ) ;
9999 Ok ( conn
100100 . prepare ( & sql) ?
@@ -120,8 +120,8 @@ pub fn select_updated_since(
120120 "# ,
121121 projection = ElementEvent :: projection( ) ,
122122 table = schema:: TABLE_NAME ,
123- updated_at = Columns :: UpdatedAt . as_str ( ) ,
124- id = Columns :: Id . as_str ( ) ,
123+ updated_at = Columns :: UpdatedAt . as_ref ( ) ,
124+ id = Columns :: Id . as_ref ( ) ,
125125 ) ;
126126 Ok ( conn
127127 . prepare ( & sql) ?
@@ -144,8 +144,8 @@ pub fn select_count_by_type_since(
144144 WHERE {type} = ?1 AND {created_at} > ?2
145145 "# ,
146146 table = schema:: TABLE_NAME ,
147- r#type = Columns :: Type . as_str ( ) ,
148- created_at = Columns :: CreatedAt . as_str ( ) ,
147+ r#type = Columns :: Type . as_ref ( ) ,
148+ created_at = Columns :: CreatedAt . as_ref ( ) ,
149149 ) ;
150150 conn. query_row ( & sql, params ! [ r#type, since. format( & Rfc3339 ) ?] , |row| {
151151 row. get ( 0 )
@@ -167,9 +167,9 @@ pub fn select_created_between(
167167 "# ,
168168 projection = ElementEvent :: projection( ) ,
169169 table = schema:: TABLE_NAME ,
170- created_at = Columns :: CreatedAt . as_str ( ) ,
171- updated_at = Columns :: UpdatedAt . as_str ( ) ,
172- id = Columns :: Id . as_str ( ) ,
170+ created_at = Columns :: CreatedAt . as_ref ( ) ,
171+ updated_at = Columns :: UpdatedAt . as_ref ( ) ,
172+ id = Columns :: Id . as_ref ( ) ,
173173 ) ;
174174 let res = conn
175175 . prepare ( & sql) ?
@@ -200,8 +200,8 @@ pub fn select_created_between_for_area(
200200 "# ,
201201 projection = ElementEvent :: projection( ) ,
202202 table = schema:: TABLE_NAME ,
203- element_id = Columns :: ElementId . as_str ( ) ,
204- created_at = Columns :: CreatedAt . as_str ( ) ,
203+ element_id = Columns :: ElementId . as_ref ( ) ,
204+ created_at = Columns :: CreatedAt . as_ref ( ) ,
205205 area_element_table = crate :: db:: main:: area_element:: schema:: TABLE_NAME ,
206206 ) ;
207207 conn. prepare ( & sql) ?
@@ -228,8 +228,8 @@ pub fn select_by_user(id: i64, limit: i64, conn: &Connection) -> Result<Vec<Elem
228228 "# ,
229229 projection = ElementEvent :: projection( ) ,
230230 table = schema:: TABLE_NAME ,
231- user_id = Columns :: UserId . as_str ( ) ,
232- created_at = Columns :: CreatedAt . as_str ( ) ,
231+ user_id = Columns :: UserId . as_ref ( ) ,
232+ created_at = Columns :: CreatedAt . as_ref ( ) ,
233233 ) ;
234234 conn. prepare ( & sql) ?
235235 . query_map ( params ! [ id, limit] , ElementEvent :: mapper ( ) ) ?
@@ -246,7 +246,7 @@ pub fn select_by_id(id: i64, conn: &Connection) -> Result<ElementEvent> {
246246 "# ,
247247 projection = ElementEvent :: projection( ) ,
248248 table = schema:: TABLE_NAME ,
249- id = Columns :: Id . as_str ( ) ,
249+ id = Columns :: Id . as_ref ( ) ,
250250 ) ;
251251 conn. query_row ( & sql, params ! [ id] , ElementEvent :: mapper ( ) )
252252 . map_err ( Into :: into)
@@ -273,14 +273,14 @@ pub fn select_by_element_id(
273273 "# ,
274274 event_table = schema:: TABLE_NAME ,
275275 user_table = crate :: db:: main:: osm_user:: schema:: NAME ,
276- id = Columns :: Id . as_str ( ) ,
277- user_id = Columns :: UserId . as_str ( ) ,
276+ id = Columns :: Id . as_ref ( ) ,
277+ user_id = Columns :: UserId . as_ref ( ) ,
278278 user_id_col = crate :: db:: main:: osm_user:: schema:: Columns :: Id . as_ref( ) ,
279- type = Columns :: Type . as_str ( ) ,
280- created_at = Columns :: CreatedAt . as_str ( ) ,
281- updated_at = Columns :: UpdatedAt . as_str ( ) ,
282- element_id = Columns :: ElementId . as_str ( ) ,
283- deleted_at = Columns :: DeletedAt . as_str ( ) ,
279+ type = Columns :: Type . as_ref ( ) ,
280+ created_at = Columns :: CreatedAt . as_ref ( ) ,
281+ updated_at = Columns :: UpdatedAt . as_ref ( ) ,
282+ element_id = Columns :: ElementId . as_ref ( ) ,
283+ deleted_at = Columns :: DeletedAt . as_ref ( ) ,
284284 ) ;
285285 let mut stmt = conn. prepare ( & sql) ?;
286286 let rows = stmt. query_map ( params ! [ element_id] , |row| {
@@ -309,8 +309,8 @@ pub fn patch_tags(
309309 WHERE {id} = ?1
310310 "# ,
311311 table = schema:: TABLE_NAME ,
312- tags = Columns :: Tags . as_str ( ) ,
313- id = Columns :: Id . as_str ( ) ,
312+ tags = Columns :: Tags . as_ref ( ) ,
313+ id = Columns :: Id . as_ref ( ) ,
314314 ) ;
315315 conn. execute ( & sql, params ! [ id, & serde_json:: to_string( tags) ?] ) ?;
316316 select_by_id ( id, conn)
@@ -329,8 +329,8 @@ pub fn set_updated_at(
329329 WHERE {id} = ?1
330330 "# ,
331331 table = schema:: TABLE_NAME ,
332- updated_at = Columns :: UpdatedAt . as_str ( ) ,
333- id = Columns :: Id . as_str ( ) ,
332+ updated_at = Columns :: UpdatedAt . as_ref ( ) ,
333+ id = Columns :: Id . as_ref ( ) ,
334334 ) ;
335335 conn. execute ( & sql, params ! [ id, updated_at. format( & Rfc3339 ) ?, ] ) ?;
336336 select_by_id ( id, conn)
0 commit comments