當前位置: 首頁>>代碼示例>>Python>>正文


Python scalars.GraphQLString方法代碼示例

本文整理匯總了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 
開發者ID:AlecAivazis,項目名稱:graphql-over-kafka,代碼行數:31,代碼來源:filter.py


注:本文中的graphql.type.scalars.GraphQLString方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。