Skip to content

Instantly share code, notes, and snippets.

@booo
Created September 19, 2011 19:21
Show Gist options
  • Select an option

  • Save booo/1227323 to your computer and use it in GitHub Desktop.

Select an option

Save booo/1227323 to your computer and use it in GitHub Desktop.
orm = require "orm"
orm.connect "postgresql://postgres:testing@localhost/orm", (success, db) ->
if not success then console.log db.message
else
Place = db.define "place", {
description:
type: "string"
geom:
type: "geom"
}
Place.sync()
berlin = new Place {
description: "Berlin"
geom: "POINT(1 1)"
}
berlin.save (error, copy) ->
if error then console.log error
else
console.log berlin.id
fn = ->
Place.find { description: "Berlin" }, (places) ->
if places then console.log places
else console.log "No place with description Berlin"
setTimeout fn, 100000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment