Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Cannot use Duration in queries #280

Open
jquesada2016 opened this issue Sep 28, 2023 · 2 comments
Open

Cannot use Duration in queries #280

jquesada2016 opened this issue Sep 28, 2023 · 2 comments

Comments

@jquesada2016
Copy link

Describe the bug
Trying to use edgedb_protocol::model::Duration, I get the following error:

error: Some(
            WrongType {
                unexpected: "BaseScalar(BaseScalarTypeDescriptor { id: BaseScalar(duration) })",
                expected: "cal::date_duration",
            },
        ),
        headers: {},
        fields: {
            (
                "capabilities",
                TypeId {
                    t: 192679019591847795036924881998469682383,
                },
            ): Any { .. },
        },
    },
)

Reproduction

let _ =
  edgedb.
    .query::<Duration, _>("select <duration>"300h", &())
    .expect("should not error");

Expected behavior
Duration to decode correctly.

Versions (please complete the following information):

  • OS: Ubuntu on WSL
  • EdgeDB version: EdgeDB 3.4+301ba34 (repl 3.5.0+907ff37)
  • EdgeDB CLI version: EdgeDB CLI 3.5.0+907ff37
  • Rust compiler version: rustc 1.72.1 (d5c2e9c34 2023-09-13)
  • Cargo version: cargo 1.72.1 (103a7ff2e 2023-08-15)
  • EdgeDB Rust versions:
    • edgedb-protocol: 0.6.0
    • edgedb-tokio: 0.5.0

Additional context
N/A

@Dhghomon
Copy link
Contributor

I just gave the query you have here a try and it's working well for me with an output of [Duration { micros: 1080000000000 }]. Can you see any clues as to why it's expecting a DateDuration on your end instead of a regular Duration?

@codeyash
Copy link

codeyash commented Oct 5, 2023

Rust Client won't support interpolation through client.

Try something like this.

format!("select <duration>"{}", "300h") 

@Dhghomon Dhghomon removed their assignment Feb 9, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants