public T GetParameter <T>(string parameter) => parameters.ContainsKey(parameter) ? (T)parameters[parameter].BindTo(typeof(T)) ! : throw new ArgumentException("Missing argument on GraphQL query").AddGraphQlError(WellKnownErrorCodes.MissingArgument, EmptyArrayHelper.Empty <QueryLocation>(), new { argument = parameter });
public static System.Collections.Generic.IReadOnlyList <QueryLocation> ToQueryLocations(this Ast.Nodes.LocationRange location) { return(location.Start.Line == 0 && location.Start.Column == 0 ? EmptyArrayHelper.Empty <QueryLocation>() : new[] { new QueryLocation(location.Start.Line, location.Start.Column) }); }
internal static IGraphQlScalarResult <TReturnType> CreateJoin(FieldContext fieldContext, LambdaExpression newFunc, IGraphQlJoin join) { return(new GraphQlExpressionScalarResult <TReturnType>(fieldContext, new[] { newFunc }, EmptyArrayHelper.Empty <ExpressionVisitor>(), ImmutableHashSet.Create(join))); }
internal static IGraphQlScalarResult <TReturnType> Simple(FieldContext fieldContext, LambdaExpression newFunc) { return(new GraphQlExpressionScalarResult <TReturnType>(fieldContext, new[] { newFunc }, EmptyArrayHelper.Empty <ExpressionVisitor>(), ImmutableHashSet <IGraphQlJoin> .Empty)); }
internal static IGraphQlScalarResult <TReturnType> Constant(TReturnType result, FieldContext fieldContext) { return(new GraphQlExpressionScalarResult <TReturnType>(fieldContext, new[] { (Expression <Func <object?, TReturnType> >)(_ => result) }, EmptyArrayHelper.Empty <ExpressionVisitor>(), ImmutableHashSet <IGraphQlJoin> .Empty)); }
public GraphQlResultFactory(FieldContext fieldContext) : base(fieldContext, new[] { identity }, EmptyArrayHelper.Empty <ExpressionVisitor>(), EmptyArrayHelper.Empty <IGraphQlJoin>()) { }