Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd650adb

Browse files
authored
Merge pull request#928 from hmac/hmac/encode-format
Delegate encode_format to T in &T and Option<T>
2 parentsd7b10f2 +17da499 commitd650adb

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

‎postgres-types/src/lib.rs‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -844,6 +844,7 @@ pub trait ToSql: fmt::Debug {
844844
/// Supported Postgres message format types
845845
///
846846
/// Using Text format in a message assumes a Postgres `SERVER_ENCODING` of `UTF8`
847+
#[derive(Clone,Copy,Debug)]
847848
pubenumFormat{
848849
/// Text format (UTF-8)
849850
Text,
@@ -867,6 +868,10 @@ where
867868
T::accepts(ty)
868869
}
869870

871+
fnencode_format(&self) ->Format{
872+
(*self).encode_format()
873+
}
874+
870875
to_sql_checked!();
871876
}
872877

@@ -886,6 +891,13 @@ impl<T: ToSql> ToSql for Option<T> {
886891
<TasToSql>::accepts(ty)
887892
}
888893

894+
fnencode_format(&self) ->Format{
895+
matchself{
896+
Some(ref val) => val.encode_format(),
897+
None =>Format::Binary,
898+
}
899+
}
900+
889901
to_sql_checked!();
890902
}
891903

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp