magpiebrain

Sam Newman's site, a Consultant at ThoughtWorks

[java]
Table person = new Table(“person”);
return select(person.star())
.from(person)
.where(person.column(“startDate”).greaterThan(“2005-01-01”)
.and(person.column(“numberOfFriends”).greaterThan(100))
.and(person.column(“age”).greaterThan(21)));
[/java]

[java]
Table person = new Table(“person”);
Column startDate = person.column(“startDate”);
Column numberOfFriends = person.column(“numberOfFriends”);
return select(person.star())
.from(person)
.where(startDate.greaterThan(“2005-01-01”)
.and(numberOfFriends.greaterThan(100)
.or(numberOfFriends.lessThan(50))));
[/java]

[java]
Table person = new Table(“person”);
return select(star())
.from(person)
.where(person.column(“psnId”).notIn(new String[] { “1”, “2” }));
[/java]

From the Squiggle acceptance tests…

Advertisements

One Response to “More Squiggle”

  1. Dan North

    greaterThan(x) looks like a flex point to me. I think I would prefer to see methods called is(Condition) and isNot(Condition) as methods on whatever-startDate-is, so I could say:

    startDate.is(greaterThan(today()) or startDate.isNot(null) or startDate.is(between(yesterday(), yesterday()+days(3)) or something. Basically that I can define my own Conditions and maybe use a bunch of standard syntactic sugar Conditions and other utility methods that squiggle provides. Or something.

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Basic HTML is allowed. Your email address will not be published.

Subscribe to this comment feed via RSS

%d bloggers like this: