diff --git a/README.md b/README.md index 233ba0b..b3f0708 100644 --- a/README.md +++ b/README.md @@ -8,24 +8,35 @@ Current status: First application is using in production! * Leverages Java 8 language capabilities to build CQL queries * Simple function-style stream API * Reactive asynchronous and synchronous API -* Provides Java mapping for Tables, Tuples, User Defined Types, Collections, UDT Collections, Tuple Collections +* Provides Java mapping for Tables, Tuples, UDFs (User Defined Types), Collections, UDT Collections, Tuple Collections ### Requirements * Only JVM 8 * Latest Datastax Driver 2.1.5 -* Latest Cassandra +* Latest Cassandra 2.1.4 * Maven ### Maven +Latest release dependency: +``` + + + com.noorq.casser + casser-core + 1.0.0 + + +``` + Active development dependency: ``` com.noorq.casser casser-core - 1.0.0-SNAPSHOT + 1.1.0-SNAPSHOT diff --git a/pom.xml b/pom.xml index 45294b4..c36b473 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 com.noorq.casser casser-core - 1.0.0 + 1.1.0-SNAPSHOT jar casser diff --git a/src/main/java/com/noorq/casser/Example.java b/src/main/java/com/noorq/casser/Example.java deleted file mode 100644 index ca2fdce..0000000 --- a/src/main/java/com/noorq/casser/Example.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (C) 2015 Noorq, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.noorq.casser; - -import static com.noorq.casser.core.Query.eq; - -import com.datastax.driver.core.Cluster; -import com.noorq.casser.core.Casser; -import com.noorq.casser.core.CasserSession; -import com.noorq.casser.core.Operator; -import com.noorq.casser.core.operation.PreparedStreamOperation; -import com.noorq.casser.support.Fun; -import com.noorq.casser.support.Fun.Tuple1; - -public class Example { - - static final User user = Casser.dsl(User.class); - - Cluster cluster = new Cluster.Builder().addContactPoint("localhost").build(); - - CasserSession session = Casser.connect(cluster).use("test").add(user).autoUpdate().get(); - - public static User mapUser(final Fun.Tuple2 t) { - - return new User() { - - @Override - public Long id() { - return null; - } - - @Override - public String name() { - return t._1; - } - - @Override - public Integer age() { - return t._2; - } - - }; - - } - - public static class UserImpl implements User { - - Long id; - String name; - Integer age; - - @Override - public Long id() { - return id; - } - - @Override - public String name() { - return name; - } - - @Override - public Integer age() { - return age; - } - - } - - public void test() { - - UserImpl newUser = new UserImpl(); - newUser.id = 100L; - newUser.name = "alex"; - newUser.age = 34; - session.upsert(newUser); - - String nameAndAge = session.select(user::name, user::age).where(user::id, eq(100L)).sync().findFirst().map(t -> { - return t._1 + ":" + t._2; - }).get(); - - User userTmp = session.select(user::name, user::age).where(user::id, eq(100L)).map(Example::mapUser).sync().findFirst().get(); - - session.update(user::age, 10).where(user::id, eq(100L)).async(); - - session.delete(User.class).where(user::id, eq(100L)).async(); - - PreparedStreamOperation> ps = session.select(user::name).where(user::id, Operator.EQ, null).prepare(); - - long cnt = ps.bind(100L).sync().count(); - - cnt = session.select(user::name).where(user::id, eq(100L)).count().sync(); - - cnt = session.select(user::name).where(user::id, eq(100L)).count().sync(); - - } - -} diff --git a/src/main/java/com/noorq/casser/User.java b/src/main/java/com/noorq/casser/User.java deleted file mode 100644 index 221b6ad..0000000 --- a/src/main/java/com/noorq/casser/User.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (C) 2015 Noorq, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.noorq.casser; - -import com.noorq.casser.mapping.annotation.Table; - -@Table("user") -public interface User { - - Long id(); - - String name(); - - Integer age(); - -}