Skip to content

Utilities to simplify use of Postgresql in my Common Lisp projects

Notifications You must be signed in to change notification settings

40ants/40ants-pg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

package 40ants-pg/connection

Classes

CONNECTION-ERROR

condition 40ants-pg/connection:connection-error (error)

Readers

reader 40ants-pg/connection:error-message (connection-error) (:message)

Functions

function 40ants-pg/connection:connect &key host database-name username password port (cached *cached-default*) (application-name nil) (use-ssl :no)

function 40ants-pg/connection:connect-toplevel

function 40ants-pg/connection:connect-toplevel-in-dev

Macros

macro 40ants-pg/connection:with-connection (&rest connect-options) &body body

Establish a new connection and start transaction

40ANTS-PG/LOCKS

package 40ants-pg/locks

Classes

LOCK-TIMEOUT

condition 40ants-pg/locks:lock-timeout (unable-to-aquire-lock)

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

Readers

reader 40ants-pg/locks:lock-timeout (lock-timeout) (:timeout)

UNABLE-TO-AQUIRE-LOCK

condition 40ants-pg/locks:unable-to-aquire-lock (simple-error)

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

Readers

reader 40ants-pg/locks:lock-key (unable-to-aquire-lock) (:key)

reader 40ants-pg/locks:lock-name (unable-to-aquire-lock) (:lock-name)

Macros

macro 40ants-pg/locks:with-lock (name &key (block t) (timeout 3) (signal-on-failure t)) &body body

40ANTS-PG/QUERY

package 40ants-pg/query

Functions

function 40ants-pg/query:all-objects-iterator 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 40ants-pg/query:execute sql &rest params

function 40ants-pg/query:select-dao-by-ids 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 40ants-pg/query:select-one-column query &key binds (column :id)

function 40ants-pg/query:sql-fetch-all sql &rest params

40ANTS-PG/SETTINGS

package 40ants-pg/settings

Functions

function 40ants-pg/settings:get-application-name

function 40ants-pg/settings:get-db-host

function 40ants-pg/settings:get-db-name

function 40ants-pg/settings:get-db-pass

function 40ants-pg/settings:get-db-port

function 40ants-pg/settings:get-db-user

function 40ants-pg/settings:get-default-application-name

40ANTS-PG/TRANSACTIONS

package 40ants-pg/transactions

Macros

macro 40ants-pg/transactions:with-transaction &body body

40ANTS-PG/UTILS

package 40ants-pg/utils

Functions

function 40ants-pg/utils:make-list-placeholders list

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

function 40ants-pg/utils:map-by-id dao-objects &key (id-slot-getter #'object-id) (test 'eql)

[generated by 40ANTS-DOC]

About

Utilities to simplify use of Postgresql in my Common Lisp projects

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published