Package com.osohq.oso_cloud.querybuilder
Interface AsyncQueryBuilder
-
- All Superinterfaces:
QueryComposer<AsyncQueryBuilder>
- All Known Implementing Classes:
AsyncQueryBuilderImpl
public interface AsyncQueryBuilder extends QueryComposer<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 providedQueryBuilderImpl.EvaluateArg.java.util.concurrent.CompletableFuture<java.lang.String>evaluateLocalFilter(java.lang.String columnName, TypedVar queryVar)Fetches a SQL fragment, which you can embed into theWHEREclause 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 calledresult.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 incolumnNamesToQueryVars(ie.-
Methods inherited from interface com.osohq.oso_cloud.querybuilder.QueryComposer
and, in, withContextFacts
-
-
-
-
Method Detail
-
evaluate
<T> java.util.concurrent.CompletableFuture<T> evaluate(QueryBuilderImpl.EvaluateArg<T> arg)
Evaluate the query based on the structure of the providedQueryBuilderImpl.EvaluateArg. The shape of the return value is determined by the specificEvaluateArgused, constructed typically via theEvaluateArgsstatic factory methods.EvaluateArgs.exists(): ReturnsBooleanindicating if the query is satisfiable.EvaluateArgs.values(TypedVar): ReturnsList<String>of values for the variable.EvaluateArgs.map(TypedVar, QueryBuilderImpl.EvaluateArg): ReturnsMap<String, SubT>where keys are unique values of the key variable, and values are the results of recursively evaluating the nested value argument (SubT). This allows arbitrarily nested structures.
- Type Parameters:
T- The expected result type, inferred from thearg.- Parameters:
arg- AnQueryBuilderImpl.EvaluateArgspecifying the desired structure of the results. UseEvaluateArgsfactory methods.- Returns:
- A Future of type
Trepresenting the evaluated results, matching the structure requested byarg. - Throws:
java.lang.IllegalArgumentException- if theargtype is internally inconsistent or unsupported (should not happen withEvaluateArgs).java.lang.NullPointerException- ifargis 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 incolumnNamesToQueryVars(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- ifcolumnNamesToQueryVarscontains 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 calledresult.See the Oso documentation for examples and limitations.
- Returns:
- Future of SQL query containing the
resultcolumn.
-
evaluateLocalFilter
java.util.concurrent.CompletableFuture<java.lang.String> evaluateLocalFilter(java.lang.String columnName, TypedVar queryVar)Fetches a SQL fragment, which you can embed into theWHEREclause 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
WHEREclause. - Throws:
java.lang.NullPointerException- ifcolumnNameorqueryVaris null.
-
-