Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for finagle mysql #6

Merged
merged 24 commits into from
Feb 23, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
c3c7c41
Add initial tentative support for MySQL client.
Dec 5, 2014
149c19c
Update to Finagle 6.24. Fix references and builders. Switch existing …
Dec 18, 2014
6e8923d
Improved client config tests. Attempted to configure Travis for when …
Dec 23, 2014
faea938
Added some simple integration tests.
Dec 23, 2014
cbf3c97
A first pass at SQL value boxing; more testing needed.
Dec 24, 2014
dd2c7bc
Dramatically improve type coercion, support more methods of querying.
Dec 24, 2014
c3dc5b7
Move value boxing/unboxing to a separate namespace and improve tests.
Jan 5, 2015
41416a0
Rename select to select-sql. Make fn1 arg optional for both that and …
Jan 5, 2015
817a91e
Improve interop for some Result subclasses.
Jan 6, 2015
17579b7
Refactor value unboxing to protocols.
Jan 6, 2015
703dc63
Merge remote-tracking branch 'upstream/master' into add_support_for_f…
Jan 6, 2015
2021229
Fixed handling of null values.
Jan 6, 2015
fc0eff8
ByteValues get unboxed as booleans unless there's another reason for …
Jan 7, 2015
1458541
Test for fixed-length CHAR column.
Jan 7, 2015
06cb208
Fix README.
Jan 7, 2015
f66c57c
Altering MySQL test credentials to use something that might work with…
Jan 8, 2015
ddf63e3
Merge remote-tracking branch 'upstream/master' into add_support_for_f…
Jan 12, 2015
c0c367d
Use version of lift->fn1 from upstream master. Small README fix.
Jan 12, 2015
a8187c0
Automatically convert to a Clojure vector, following the Principle of…
Jan 12, 2015
0959a9e
Attempt to fix Travis build by manually creating a user.
Jan 12, 2015
5a3281b
Try to improve quoting.
Jan 12, 2015
7afb1ec
Execute db setup with root privileges.
Jan 12, 2015
291cf6e
Losing sequential checks in favor of backgrounding table creation in …
Jan 21, 2015
31a8c0c
Change localhost to 127.0.0.1, fix imports, fix table capitalization.
Feb 20, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
language: clojure
sudo: false
lein: lein2
install: lein2 sub -s "lein-finagle-clojure:finagle-clojure-template:core:thrift" install
install: lein2 sub -s "lein-finagle-clojure:finagle-clojure-template:core:thrift:http:mysql" install
script: lein2 sub with-profile dev:1.5,test:1.4,test midje
jdk:
- openjdk7
services:
- mysql
before_script:
- mysql -uroot -e "create database finagle_clojure_test; create user 'finagle'@'127.0.0.1' identified by 'finagle'; grant all privileges on finagle_clojure_test.* to 'finagle'@'127.0.0.1'; flush privileges;"
13 changes: 13 additions & 0 deletions mysql/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
pom.xml
pom.xml.asc
*jar
/lib/
/classes/
/target/
/checkouts/
.lein-deps-sum
.lein-repl-history
.lein-plugins/
.lein-failures
.nrepl-port
*iml
32 changes: 32 additions & 0 deletions mysql/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# mysql

This module contains wrappers for `com.twitter.finagle.exp.mysql.Client` and automatic boxing/unboxing of values
to idiomatic Clojure vectors of hashmaps.

### Usage

```clojure
(ns user
(:require [finagle-clojure.mysql.client :refer :all]
[finagle-clojure.futures :as f]
[finagle-clojure.scala :as scala]))

(let [db (-> (mysql-client)
(with-credentials "test" "test")
(with-database "some_database")
(rich-client "localhost:3306"))]
(-> (prepare db "SELECT * FROM widgets WHERE manufacturer_id = ? AND sold_count > ?")
(select-stmt [12 5])
(f/await)) ;; => [{:id 1 :manufacturer_id 12 :sold_count 12} ...]
)
```

### Dependency

[finagle-clojure/mysql "0.2.1-SNAPSHOT"]

### Namespaces

* `finagle-clojure.mysql.client`: a collection of functions for connecting to a MySQL client and parsing the results
* `finagle-clojure.mysql.value`: private helpers for translating values between Java/Clojure types and internal
finagle-mysql types
13 changes: 13 additions & 0 deletions mysql/project.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
(defproject finagle-clojure/mysql "0.2.1-SNAPSHOT"
:description "A light wrapper around Finagle MySQL support"
:url "https://github.com/twitter/finagle-clojure"
:license {:name "Apache License, Version 2.0"
:url "https://www.apache.org/licenses/LICENSE-2.0"}
:scm {:name "git" :url "http://github.com/finagle/finagle-clojure"}
:plugins [[lein-midje "3.1.3"]]
:profiles {:test {:dependencies [[midje "1.6.3" :exclusions [org.clojure/clojure]]]}
:dev [:test {:dependencies [[org.clojure/clojure "1.6.0"]]}]
:1.5 {:dependencies [[org.clojure/clojure "1.5.1"]]}
:1.4 {:dependencies [[org.clojure/clojure "1.4.0"]]}}
:dependencies [[finagle-clojure/core "0.2.1-SNAPSHOT"]
[com.twitter/finagle-mysql_2.10 "6.24.0"]])
Loading