Skip to content

Use Query type instead of str #16

@ikhoon

Description

@ikhoon

#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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions