From 323ce05162e33de8eae9eb9bf3d4bc97fb8bad7c Mon Sep 17 00:00:00 2001 From: Albert Shift Date: Mon, 27 Apr 2015 20:50:16 -0700 Subject: [PATCH] removed Example.java, the file from what the project was started ;) --- README.md | 2 +- src/main/java/com/noorq/casser/Example.java | 110 -------------------- src/main/java/com/noorq/casser/User.java | 29 ------ 3 files changed, 1 insertion(+), 140 deletions(-) delete mode 100644 src/main/java/com/noorq/casser/Example.java delete mode 100644 src/main/java/com/noorq/casser/User.java diff --git a/README.md b/README.md index 233ba0b..7de48c4 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ Active development dependency: com.noorq.casser casser-core - 1.0.0-SNAPSHOT + 1.1.0-SNAPSHOT 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(); - -}