launchbadge/sqlx

Extend derive(FromRow) with additional features/attributes

オープン

#156 opened on 2020/03/26

 (2 件のコメント) (19 件のリアクション) (0 人の担当者)Rust (1,307 件のフォーク)batch import
E-mediumenhancementgood first issuehelp wanted

Repository metrics

Stars
 (13,916 個のスター)
PR merge metrics
 (PR metrics pending)

説明

  • Handle #[sqlx(rename = "new_name")] on a struct field

  • Support the derive on a tuple struct and use by ordinal retrieval from the row

  • Handle #[sqlx(ordinal = 3)] to use ordinal retrieval from the row ( row.get(3) )

  • Handle a field that is impl FromRow. A parallel from serde_json would perhaps make this #[sqlx(flatten)].

    #[derive(sqlx::FromRow)]
    struct Bar {
        baz: i32  // row.get("baz")
     }
    
    #[derive(sqlx::FromRow)]
    struct Foo {
        foo: i32, // row.get("foo")
        #[sqlx(flatten)]
        bar: Bar
    }
    

コントリビューターガイド