本文整理匯總了Python中graphql.type.scalars.GraphQLString方法的典型用法代碼示例。如果您正苦於以下問題:Python scalars.GraphQLString方法的具體用法?Python scalars.GraphQLString怎麽用?Python scalars.GraphQLString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類graphql.type.scalars
的用法示例。
在下文中一共展示了scalars.GraphQLString方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: args_for_model
# 需要導入模塊: from graphql.type import scalars [as 別名]
# 或者: from graphql.type.scalars import GraphQLString [as 別名]
def args_for_model(model):
# import the model field helper
from .util import fields_for_model
# figure use each field as a filter
args = fields_for_model(model)
# add the pk argument
args['pk'] = convert_peewee_field(model.primary_key())
# create a copy of the argument dict we can mutate
full_args = args.copy()
# todo: add type-specific filters
# go over the arguments
for arg, field_type in args.items():
# add the list member filter
full_args[arg + '_in'] = List(field_type)
# add integer valued model filters
for arg in ['first', 'last', 'offset']:
# add the arg to the dict
full_args[arg] = Int()
# add the list of string values model filters
for arg in ['order_by']:
# add the arg to the dict
full_args[arg] = List(GraphQLString)
# return the complete dictionary of arguments
return full_args