magic.lambda.pgsql

This is the PostgreSQL data adapter for Magic. This project allows you to provide a semantic lambda structure to its slots, which in turn will dynamically create a PostgreSQL dialect SQL statement for you, for all basic types of CRUD SQL statements. In addition, it provides slots to open a PostgreSQL database connection, and such allows you to declare your own SQL statements to be executed towards a PostgreSQL database. Slots this project contains are as follows.

  • [pgsql.connect] - Connects to a database
  • [pgsql.create] - Creates a single record in the specified table
  • [pgsql.read] - Reads multiple records from the specified table
  • [pgsql.update] - Updates a single record in the specified table
  • [pgsql.delete] - Deletes a single record in the specified table
  • [pgsql.select] - Executes an arbitrary SQL statement, and returns results of reader as lambda objects to caller
  • [pgsql.scalar] - Executes an arbitrary SQL statement, and returns the result as a scalar value to caller
  • [pgsql.execute] - Executes an aribitrary SQL statement
  • [pgsql.transaction.create] - Creates a new transaction
  • [pgsql.transaction.commit] - Explicitly commits an open transaction
  • [pgsql.transaction.rollback] - Explicitly rolls back an open transaction

Notice - If you use any of the CRUD slots from above, the whole idea is that you can polymorphistically use the same lambda object, towards any of the underlaying database types, and the correct specific syntax for your particular database vendor’s SQL syntax will be automatically generated. This allows you to transparently use the same lambda object, towards any of the database types Magic supports, without having to change it in any ways.

All of the slots in this project are documented in the documentation for the “magic.data.common” project. If you replace the [data.xxx] or [sql.xxx] slots with [pgsql.xxx], you will use the PgSQL specific slots, instead of the generic, and/or polymorphistic slots. Hence, please refer to the documentation for “magic.data.common” to see the complete documentation for this project. If you need for instance documentation about the [pgsql.connect] slot you should look for the documentation for [data.connect], since it’s more or less the exact same documentation.