Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

feat(query): add method and type #122

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft

Conversation

dan-online
Copy link
Member

@dan-online dan-online commented Oct 29, 2022

Note: could change return values to be of KeyPath

Example usage:

await josh.set("hello", "world");
await josh.set("foo", "bar");

const hello = await josh.query({ key: "hello" }); // ["world"]
const notHello = await josh.query({ key: { ne: "hello" }}); // ["bar"]
const neither = await josh.query({ value: "woah" }); // []
await josh.set("hello", 1);
await josh.set("foo", 2);

const both = await josh.query({ value: { gte: 1 }}); // [1,2]
const first = await josh.query({ value: { lt: 2 }}); // [1]
await josh.set("hello", { num: 1 });
await josh.set("foo", { num: 2 });

const both = await josh.query({ value: { num: { gte: 1 } }}); // [1,2]
const first = await josh.query({ value: { num: { lt: 2 } }}); // [1]

@codecov
Copy link

codecov bot commented Oct 29, 2022

Codecov Report

Merging #122 (37cc374) into main (e4e02bd) will increase coverage by 0.16%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #122      +/-   ##
==========================================
+ Coverage   92.75%   92.91%   +0.16%     
==========================================
  Files          29       30       +1     
  Lines        2387     2442      +55     
  Branches      129      130       +1     
==========================================
+ Hits         2214     2269      +55     
  Misses        170      170              
  Partials        3        3              
Impacted Files Coverage Δ
packages/provider/src/lib/types/Method.ts 100.00% <100.00%> (ø)
packages/provider/src/lib/types/Payload.ts 100.00% <100.00%> (ø)
packages/provider/src/lib/types/Query.ts 100.00% <100.00%> (ø)
packages/provider/src/lib/types/index.ts 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@dan-online dan-online force-pushed the feat/add-query-method branch from d06f94f to 66bccf7 Compare October 30, 2022 18:19
@dan-online dan-online added the hacktoberfest-accepted Issues and PRs related to Hacktoberfest. label Oct 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hacktoberfest-accepted Issues and PRs related to Hacktoberfest.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant