rethinkdb / rethinkdb-rs

A native RethinkDB driver written in Rust
Apache License 2.0
210 stars 27 forks source link

Allow creating index using binary representation #63

Open kid opened 2 years ago

kid commented 2 years ago

While building an alternative import tool for rethinkdb using Rust, I found myself trying to create index using the binary representation, as exported by the official export tool.

However, the current implementation always wrap everything in a Func so that didn't work, this PR is an attempt to fix that.

There's probably a better way to do this, but I'm not sure how.

kid commented 2 years ago

I've confirmed this is working as expected using something like this

match r
    .db("foo")
    .table("bar")
    .index_create(r.args((
        "baz"
        json!({
            "$reql_type$": "BINARY",
            "data": "<base64>"
        }),
    )))
    .run::<_, ijson::IValue>(&conn)
    .try_next()
    .await?