Search in sources :

Example 11 with SQLPredicate

use of com.amplifyframework.datastore.storage.sqlite.adapter.SQLPredicate in project amplify-android by aws-amplify.

the class SQLPredicateTest method testContainsForStringList.

/**
 * Test contains in the context of a list.
 * @throws DataStoreException Not thrown.
 */
@Test
public void testContainsForStringList() throws DataStoreException {
    QueryPredicateOperation<String> predicate = Blog.TAGS.contains("something");
    SQLPredicate sqlPredicate = new SQLPredicate(predicate);
    validateSQLExpressionForContains(sqlPredicate, "tags");
}
Also used : SQLPredicate(com.amplifyframework.datastore.storage.sqlite.adapter.SQLPredicate) Test(org.junit.Test)

Example 12 with SQLPredicate

use of com.amplifyframework.datastore.storage.sqlite.adapter.SQLPredicate in project amplify-android by aws-amplify.

the class SQLPredicateTest method testIsNull.

/**
 * Test IS NULL expression.
 * @throws DataStoreException Not thrown.
 */
@Test
public void testIsNull() throws DataStoreException {
    SQLPredicate sqlPredicate = new SQLPredicate(Where.matches(Blog.NAME.eq(null)).getQueryPredicate());
    System.out.println(sqlPredicate.toString());
    assertEquals("name IS NULL", sqlPredicate.toString());
}
Also used : SQLPredicate(com.amplifyframework.datastore.storage.sqlite.adapter.SQLPredicate) Test(org.junit.Test)

Aggregations

SQLPredicate (com.amplifyframework.datastore.storage.sqlite.adapter.SQLPredicate)12 Test (org.junit.Test)8 QueryPredicate (com.amplifyframework.core.model.query.predicate.QueryPredicate)6 NonNull (androidx.annotation.NonNull)4 SQLiteTable (com.amplifyframework.datastore.storage.sqlite.adapter.SQLiteTable)4 SQLiteColumn (com.amplifyframework.datastore.storage.sqlite.adapter.SQLiteColumn)2 ArrayList (java.util.ArrayList)2 QueryPaginationInput (com.amplifyframework.core.model.query.QueryPaginationInput)1 QuerySortBy (com.amplifyframework.core.model.query.QuerySortBy)1 QueryPredicateOperation (com.amplifyframework.core.model.query.predicate.QueryPredicateOperation)1 HashMap (java.util.HashMap)1 List (java.util.List)1