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

Use Query type instead of str #16

Open
ikhoon opened this issue Oct 29, 2021 · 0 comments
Open

Use Query type instead of str #16

ikhoon opened this issue Oct 29, 2021 · 0 comments
Labels

Comments

@ikhoon
Copy link
Contributor

ikhoon commented Oct 29, 2021

#14 introduced Query type. The existing APIs that use a string as a query expression need to be updated such as.

path_pattern: Optional[str],

class Query(Generic[T]):
@staticmethod
def identity(path: str) -> Query[str]:
return Query(path=path, query_type=QueryType.IDENTITY, expressions=[])
@staticmethod
def text(path: str) -> Query[str]:
return Query(path=path, query_type=QueryType.IDENTITY_TEXT, expressions=[])
@staticmethod
def json(path: str) -> Query[Any]:
return Query(path=path, query_type=QueryType.IDENTITY_JSON, expressions=[])
@staticmethod
def json_path(path: str, json_paths: List[str]) -> Query[Any]:
return Query(path=path, query_type=QueryType.JSON_PATH, expressions=json_paths)

@ikhoon ikhoon added the cleanup label Oct 29, 2021
@ikhoon ikhoon added this to the 0.1.0 milestone Oct 29, 2021
@hexoul hexoul modified the milestones: 0.1.0, 0.2.0 Jul 3, 2022
@ikhoon ikhoon modified the milestones: 0.2.0, 0.3.0 Aug 17, 2022
@hexoul hexoul removed this from the 0.3.0 milestone Sep 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants