Skip to content

Instantly share code, notes, and snippets.

View igrishaev's full-sized avatar

Ivan Grishaev igrishaev

View GitHub Profile
(defn parse-reader [^Reader reader]
(-> reader
(BufferedReader. 0xFFFF)
(.lines)
(.skip 1)
(.map (reify Function
(apply [_ line]
(-> line
(data.csv/read-csv)
(ffirst)
BOOLEAN (java.lang.Boolean)
INT2 (java.lang.Short)
INT4 (java.lang.Integer)
INT8 (java.lang.Long)
FLOAT4 (java.lang.Float)
FLOAT8 (java.lang.Double)
CHAR (java.lang.String)
VARCHAR (java.lang.String)
TEXT (java.lang.String)
ENUM (java.lang.String)
(ns pg.client-test
(:import
com.github.igrishaev.Connection)
(:import
java.io.ByteArrayInputStream
java.io.ByteArrayOutputStream
java.time.Instant
java.time.LocalDate
java.time.LocalDateTime
java.time.LocalTime
package com.github.igrishaev;
import clojure.lang.PersistentVector;
import clojure.lang.PersistentVector$TransientVector;
public class VectorReducer implements IReducer<PersistentVector$TransientVector, PersistentVector> {
PersistentVector$TransientVector initiate() {
return PersistentVector.EMPTY().asTransient();
}
var Circle = {
PI: 3.1415,
init:
function (x) {
var obj = Object.create(Circle);
obj.x = x;
return obj;
(as-manager ...
)
(with-context [foo1 {}
bar2 {}]
)
(do
(letfn [(->iter [coll]
(clojure.lang.RT/iter coll))
(has-next? [iter]
(.hasNext ^java.util.Iterator iter))
(next! [iter]
(.next ^java.util.Iterator iter))]
(defn map!
([f coll]
(mapv f coll))
([f coll & colls]
(ns repl
(:require
[pg.client :as pg]))
(def config
{:host "127.0.0.1"
:port 10150
:user "test"
:password "test"
:database "test"})
(defn gipz-encode ^bytes [^bytes input]
(let [in
(new ByteArrayInputStream input)
out-bytes
(new ByteArrayOutputStream)
out-gzip
(new GZIPOutputStream out-bytes true)
#_(def any-refs
(some-fn :venue
:tour
:media
:ticket-classes
:orders
:tickets
:purchaser
:attendee))