Skip to content

Instantly share code, notes, and snippets.

@ashish-mj
Created April 26, 2024 08:01
Show Gist options
  • Save ashish-mj/8913d27713a40a4d6cd68df22efc271d to your computer and use it in GitHub Desktop.
Save ashish-mj/8913d27713a40a4d6cd68df22efc271d to your computer and use it in GitHub Desktop.
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