Created
April 26, 2024 08:01
-
-
Save ashish-mj/8913d27713a40a4d6cd68df22efc271d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from graphene import ObjectType,List,Field,String | |
from gql.type import EmployeeObject | |
from db.couchbase import dbClient | |
class Query(ObjectType): | |
employeeList = List(EmployeeObject) | |
employee = Field(EmployeeObject,id=String(required="True")) | |
@staticmethod | |
def resolve_employeeList(root,info): | |
return list(dbClient.query("SELECT db_employee.* from db_employee WHERE meta().id LIKE 'EMP1%'")) | |
@staticmethod | |
def resolve_employee(root,info,id): | |
return dbClient.get(id).value |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment