Liking cljdoc? Tell your friends :D

Deta Clojure Library

Clojars Project License: MIT Documentation

Deta is a Clojure library designed to simplify interactions with the Deta database. It provides a straightforward way to initialize a database connection and perform basic operations such as inserting data. This library is ideal for developers looking to integrate Deta database functionality into their Clojure applications.

Table of Contents

Features

  • Database Initialization: Easily establish a connection to a Deta database with a straightforward function call.
  • Data Insertion: Insert data into the Deta database, supporting various data types.
  • Data Update: Update existing data in the Deta database or insert new data if the key does not exist.
  • Data Retrieval: Fetch data from the Deta database by specifying a key.
  • Data Deletion: Remove data from the Deta database by specifying a key.
  • Testing: A comprehensive test suite is essential to ensure reliability and accuracy.

Documentation

To fully understand how to use this software, referring to the comprehensive documentation available at https://adaiasmagdiel.github.io/deta-clojure/.

Getting Started

Prerequisites

  • Clojure 1.10 or later
  • Leiningen 2.9.1 or later

Installation

This library is now available as a dependency. You can add it to your project using Leiningen/Boot by including the following in your project.clj dependencies:

[com.adaiasmagdiel/deta "0.0.3"]

For more installation methods, such as Clojure CLI/deps.edn, Gradle, and Maven, please refer to the installation section of our documentation.

Usage

Initializing a Deta Base Connection

(def db (base/base "your_collection_key" "your_basename"))

Inserting Data

(base/put db {:a 1 :b 2} "item-key")
(base/put db {:c 3 :d 4}) ; The key is automatically generated on the server
(base/insert db {:a 1 :b 2} "item-key")
(base/insert db {:c 3 :d 4}) ; The key is automatically generated on the server

Please refer to the documentation to understand the distinction between "put" and "insert".

Retrieving Data

(base/get db "item-key")

Deleting Data

(base/delete db "item-key")

For more detailed usage instructions and examples, please refer to the usage section of our documentation.

Testing

The library includes a test suite that covers various scenarios. To run the tests, set the DETA_KEY environment variable with a valid Deta key beforehand.

Windows

set DETA_KEY=your_deta_key_here
lein test

Linux/MacOS

export DETA_KEY=your_deta_key_here
lein test

Replace your_deta_key_here with your actual Deta key.

Contributing

Contributions are always welcome! Please review the code and send suggestions or pull requests to improve the library.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contact

For any questions or suggestions, please open an issue on GitHub.

Can you improve this documentation?Edit on GitHub

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close