Skip to content

Instantly share code, notes, and snippets.

@timowest
timowest / querydsl.scala
Created November 30, 2011 22:05
Querydsl Scala syntax
// DEFAULT AND COMPACT SYNTAX COMPARED
// for each example the default and compact syntax are shown
// select single
query.from(survey).select(survey.id) // default
survey.select(_.id) // compact
// select single 2
query.from(employee).select(employee.firstname)
@timowest
timowest / gist:4016436
Created November 5, 2012 10:05
Querydsl Alias usage
Person p = alias(Person.class);
List<Person> persons = query.from($(p))
.where($(p.getName()).eq("Jason").and(
$(p.getAge()).gt(10)).and(
$(p.getCountry()).like("Canad*")).or(
$(p.getName()).eq("Dhanji").and(
$(p.getCountry()).ne("Canada"))))
.list($(p));
@timowest
timowest / gist:4653645
Created January 28, 2013 07:25
LV2 synth in symbol language (typed Clojure dialect)
(ns synth
(include "cmath"
"lv2/lv2plug.in/ns/lv2core/lv2.h"))
(defstruct Synth
(sample-rate double)
(phase float)
(freq float*)
(output float*))
@timowest
timowest / gist:5098112
Last active March 16, 2023 23:28
Querydsl and/or examples
#1
e1.or(e2).and(e3))
creates at first an 'or' operation based on e1 and e2 and uses this 'or' operation
in a top level 'and' operation with e3 as the second operand.
Since 'and' has higher precedence than 'or' it is serialized as
(e1 or e2) and e3