本文整理汇总了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