Interface AsyncQueryBuilder

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      <T> java.util.concurrent.CompletableFuture<T> evaluate​(QueryBuilderImpl.EvaluateArg<T> arg)
      Evaluate the query based on the structure of the provided QueryBuilderImpl.EvaluateArg.
      java.util.concurrent.CompletableFuture<java.lang.String> evaluateLocalFilter​(java.lang.String columnName, TypedVar queryVar)
      Fetches a SQL fragment, which you can embed into the WHERE clause of a SQL query against your database to filter out unauthorized rows (ie.
      java.util.concurrent.CompletableFuture<java.lang.String> evaluateLocalSelect()
      Fetches a complete SQL query that can be run against your database, selecting a single row with a boolean column called result.
      java.util.concurrent.CompletableFuture<java.lang.String> evaluateLocalSelect​(java.util.Map<java.lang.String,​TypedVar> columnNamesToQueryVars)
      Fetches a complete SQL query that can be run against your database, selecting a row for each authorized combination of the query variables in columnNamesToQueryVars (ie.
    • Method Detail

      • evaluate

        <T> java.util.concurrent.CompletableFuture<T> evaluate​(QueryBuilderImpl.EvaluateArg<T> arg)
        Evaluate the query based on the structure of the provided QueryBuilderImpl.EvaluateArg. The shape of the return value is determined by the specific EvaluateArg used, constructed typically via the EvaluateArgs static factory methods.
        Type Parameters:
        T - The expected result type, inferred from the arg.
        Parameters:
        arg - An QueryBuilderImpl.EvaluateArg specifying the desired structure of the results. Use EvaluateArgs factory methods.
        Returns:
        A Future of type T representing the evaluated results, matching the structure requested by arg.
        Throws:
        java.lang.IllegalArgumentException - if the arg type is internally inconsistent or unsupported (should not happen with EvaluateArgs).
        java.lang.NullPointerException - if arg is null.
      • evaluateLocalSelect

        java.util.concurrent.CompletableFuture<java.lang.String> evaluateLocalSelect​(java.util.Map<java.lang.String,​TypedVar> columnNamesToQueryVars)
        Fetches a complete SQL query that can be run against your database, selecting a row for each authorized combination of the query variables in columnNamesToQueryVars (ie. combinations of variables that satisfy the Oso query).

        See the Oso documentation for examples and limitations.

        Parameters:
        columnNamesToQueryVars - A mapping of the desired column names to the query variables whose values will be selected into those columns in the returned SQL query.
        Returns:
        Future of SQL query containing the desired columns.
        Throws:
        java.lang.IllegalArgumentException - if columnNamesToQueryVars contains duplicate variable values.
      • evaluateLocalSelect

        java.util.concurrent.CompletableFuture<java.lang.String> evaluateLocalSelect()
        Fetches a complete SQL query that can be run against your database, selecting a single row with a boolean column called result.

        See the Oso documentation for examples and limitations.

        Returns:
        Future of SQL query containing the result column.
      • evaluateLocalFilter

        java.util.concurrent.CompletableFuture<java.lang.String> evaluateLocalFilter​(java.lang.String columnName,
                                                                                     TypedVar queryVar)
        Fetches a SQL fragment, which you can embed into the WHERE clause of a SQL query against your database to filter out unauthorized rows (ie. rows that don't satisfy the Oso query).

        See the Oso documentation for examples and limitations.

        Parameters:
        columnName - The name of the SQL column to filter.
        queryVar - The variable corresponding to the column to filter.
        Returns:
        Future of SQL fragment, suitable for embedding in a WHERE clause.
        Throws:
        java.lang.NullPointerException - if columnName or queryVar is null.