Module luchia

Summary of the project, start the documentation journey here.

Overview

Luchia provides both low-level and high-level access to CouchDB, using an object-oriented approach.

All of the basic operations are supported, including:

  • CRUD operations on databases.
  • CRUD operations on documents.
  • CRUD operations on attachments (both inline and standalone).
  • uuid generation (server side).
  • Various utility functions.

Low-level access is provided by the 'core' modules, while higher-level access is provided by the database, document, and utilities modules.

The package also includes luchia_get, a command-line script that can be used to perform simple GET requests to the default server.

Configuration

See luchia.conf for configuration details.

Usage

In general, avoid using the core classes directly unless an operation is needed that isn't supported by the higher-level modules.

Detailed examples are provided in relevant module documentation, but here's a quick primer:

-- Load all modules.
require "luchia"
-- Create new document handler for the 'example' database.
local doc = luchia.document:new("example")
-- Simple document.
local contents = { hello = "world" }
-- Create new document.
local resp = doc:create(contents)
-- Check for successful creation.
if doc:response_ok(resp) then
  -- Update document contents.
  contents = { hello = "world", foo = "bar" }
  -- Update document.
  doc:update(contents, resp.id, resp.rev)
end

Author:

Chad Phillips

Copyright© 2011 Chad Phillips



Valid XHTML 1.0!