HTTPS SSH

persistent-records-postgresql

This Chicken Scheme library is a PostgreSQL backend for persistent-records.

Requirements

API

Two different parameters can be used to configure the database, database-connection and database.

database-connection, if provided, should be a postgresql connection object (as returned by connect), and will be shared amongst all requests.

database, if provided, will only be used when no database-connection is specified, and should be an alist of connection options (again matching connect's specification). In this case, a new database connection will be created and subsequently closed on each query.

(use postgresql persistent-records-postgresql)

(database-connection
 (connect
  '((user   . alice)
    (dbname . wonderland))))

(define-persistent-record-type playing-card
  (rank (type "char(1)")
        (constraint not null))
  (suit (type integer)
        (default 0)
        (constraint not null)))

(define card (make-playing-card rank: "A"))
; => #<playing-card id: () rank: "A" suit: () dirty: (rank)>

(playing-card-save! card)
; => #<playing-card id: 1 rank: "A" suit: 0>

Author

Evan Hanson evhan@foldling.org

License

BSD. See LICENSE for details.