launchbadge/sqlx

Extend derive(FromRow) with additional features/attributes

开放

#156 创建于 2020年3月26日

 (2 条评论) (19 个反应) (0 位负责人)Rust (1,307 个派生)batch import
E-mediumenhancementgood first issuehelp wanted

仓库指标

星标
 (13,916 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

  • 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
    }
    

贡献者指南