mirror of
https://github.com/Diggsey/sqlxmq.git
synced 2024-11-25 01:31:03 +00:00
Merge pull request #18 from FlixCoder/patch-1
Document the macro-generated static
This commit is contained in:
commit
6d3ed6fb99
2 changed files with 7 additions and 1 deletions
|
@ -231,6 +231,11 @@ pub fn job(attr: TokenStream, item: TokenStream) -> TokenStream {
|
|||
}
|
||||
}
|
||||
|
||||
let outer_docs = inner_fn
|
||||
.attrs
|
||||
.iter()
|
||||
.filter(|attr| attr.path.is_ident("doc"));
|
||||
|
||||
let vis = mem::replace(&mut inner_fn.vis, Visibility::Inherited);
|
||||
let name = mem::replace(&mut inner_fn.sig.ident, parse_quote! {inner});
|
||||
let fq_name = if let Some(name) = options.name {
|
||||
|
@ -281,6 +286,7 @@ pub fn job(attr: TokenStream, item: TokenStream) -> TokenStream {
|
|||
|
||||
let expanded = quote! {
|
||||
#(#errors)*
|
||||
#(#outer_docs)*
|
||||
#[allow(non_upper_case_globals)]
|
||||
#vis static #name: &'static sqlxmq::NamedJob = &{
|
||||
#inner_fn
|
||||
|
|
|
@ -242,7 +242,7 @@ pub fn should_retry(error: &sqlx::Error) -> bool {
|
|||
if let Some(db_error) = error.as_database_error() {
|
||||
// It's more readable as a match
|
||||
#[allow(clippy::match_like_matches_macro)]
|
||||
match (db_error.code().as_deref(), db_error.constraint().as_deref()) {
|
||||
match (db_error.code().as_deref(), db_error.constraint()) {
|
||||
// Foreign key constraint violation on ordered channel
|
||||
(Some("23503"), Some("mq_msgs_after_message_id_fkey")) => true,
|
||||
// Unique constraint violation on ordered channel
|
||||
|
|
Loading…
Reference in a new issue