From 600a5e4841a4aeaf919b392ceaad91693c663601 Mon Sep 17 00:00:00 2001 From: Grant Sander Date: Fri, 11 Aug 2023 12:48:26 -0500 Subject: [PATCH] `.order` input type (#214) Order input --- .changeset/early-spies-teach.md | 5 +++++ packages/groqd/src/builder.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/early-spies-teach.md diff --git a/.changeset/early-spies-teach.md b/.changeset/early-spies-teach.md new file mode 100644 index 00000000..abcc0eed --- /dev/null +++ b/.changeset/early-spies-teach.md @@ -0,0 +1,5 @@ +--- +"groqd": patch +--- + +Addresses #213, allows the .order method to take an array of strings – since order argument can be more complex than just `FIELD desc` diff --git a/packages/groqd/src/builder.ts b/packages/groqd/src/builder.ts index 8d69203e..149a6c01 100644 --- a/packages/groqd/src/builder.ts +++ b/packages/groqd/src/builder.ts @@ -201,7 +201,7 @@ export class ArrayQuery extends BaseQuery< }); } - order(...orderings: `${string} ${"asc" | "desc"}`[]): ArrayQuery { + order(...orderings: string[]): ArrayQuery { return new ArrayQuery({ ...this.value(), query: this.query + `|order(${orderings.join(", ")})`,