We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I'd like to be able to change the name of the class as it's represented in the query.
Example:
class HeroAndDroid(NamedTuple): hero: Hero droid: Droid
and instead of
print(GQL(QUERY | HeroAndDroid).query) # 'query HeroAndDroid{hero{name}droid{name}}'
I'd like to do something like
print(GQL(QUERY | HeroAndDroid * AS * 'asdf').query) # 'query asdf{hero{name}droid{name}}'
or
print(GQL(QUERY | HeroAndDroid * AS * ANONYMOUS).query) # 'query {hero{name}droid{name}}'
Of course I can do it like this
#RENAME = lambda cls, name: type(name, (cls,), {}) RENAME = lambda cls, name: (setattr(cls, '__name__', name), cls)[-1] print(GQL(QUERY | RENAME(HeroAndDroid, 'I_Prefer_This_Name')).query) # 'query I_Prefer_This_Name{hero{name}droid{name}}'
but I think using the AS function for this is much more suitable.
AS
The text was updated successfully, but these errors were encountered:
A possible solution:
@mul_infix def AS(a: Binding, b: str) -> Binding: if isinstance(a, Binding): return a._replace(variable_alias=b) a.__name__ = b return a
Not sure if it's enough though but it works fine with my basic example
Sorry, something went wrong.
No branches or pull requests
I'd like to be able to change the name of the class as it's represented in the query.
Example:
and instead of
I'd like to do something like
or
Of course I can do it like this
but I think using the
AS
function for this is much more suitable.The text was updated successfully, but these errors were encountered: