40ants-pg - A set of utilities to work with Postgresql using Mito and Common Lisp.

40ANTS-PG ASDF System Details

Installation

You can install this library from Quicklisp, but you want to receive updates quickly, then install it from Ultralisp.org:

(ql-dist:install-dist "http://dist.ultralisp.org/"
                      :prompt nil)
(ql:quickload :40ants-pg)

Usage

TODO: Write a library description. Put some examples here.

API

40ANTS-PG/CONNECTION

Classes

CONNECTION-ERROR

Readers

Functions

function
&key host database-name username password port (cached \*cached-default\*) (application-name nil) (use-ssl :no)

Macros

macro
(&rest connect-options) &body body

Establish a new connection and start transaction

40ANTS-PG/LOCKS

Classes

LOCK-TIMEOUT

Raised when you are trying to get lock to was unable to do this during current lock_timeout.

Readers

UNABLE-TO-AQUIRE-LOCK

Signaled if some thread was unable to get a lock on a database.

Readers

Macros

macro
(name &key (block t) (timeout 3) (signal-on-failure t)) &body body

40ANTS-PG/QUERY

Functions

function
class &key (id-slot-getter #'object-id) (id-slot :id) (batch-size 10)

Iterates through all objects of given class fetching them in batches.

function
CLASS-NAME IDS &KEY (ID-FIELD "id") (ID-SLOT-GETTER #'OBJECT-ID) (SQL "SELECT \* FROM {{table}} WHERE \"{{column}}\" in {{placeholders}}")

Returns CLOS objects with given ids.

Results are returned in the same order as was in ids list. If some objects were not fetched, nil is returned at it's position in the resulting list.

function
query &key binds (column :id)

40ANTS-PG/SETTINGS

Functions

40ANTS-PG/TRANSACTIONS

Macros

40ANTS-PG/UTILS

Functions

Given a list of items, returns a string like "(?,?,?)" where number of questionmarks corresponds to number of list items.

function
dao-objects &key (id-slot-getter #'object-id) (test 'eql)