Daniel-Boll / charydbis.js

πŸš€ NodeJS ScyllaDB ORM. πŸ§ͺπŸ”§

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

scylladb

πŸš€ JavaScript ORM for ScyllaDB. Pre-release stage. πŸ§ͺπŸ”§

πŸ“₯ Installing πŸ“₯

To install this package, use the following command:

npm i @lambda-group/charydbis @lambda-group/scylladb

πŸš€ Getting Started πŸš€

These instructions will get you a copy of the project up and running πŸƒ on your local machine for development and testing purposes.

πŸ“‹ Prerequisites πŸ“‹

  • Docker: We use Docker 🐳 to run the Scylla database easily without the need for a complex local setup.
  • Node.js: Make sure you have Node.js installed on your system to run JavaScript code.
  • Scylla Driver: To handle the connections.

🌟 Quickstart 🌟

  1. Start ScyllaDB in Docker:

    Run a ScyllaDB instance using the following Docker command:

    docker run --name scylladb -d --rm -it -p 9042:9042 scylladb/scylla --smp 2

    This command pulls the Scylla image if it's not already present on your system, and starts a new 🌟 container with the Scylla database.

  2. Create a DataSource:

    Here's a simple script that creates a data source:

    import { DataSource } from "@lambda-group/charydbis";
    
    using scyllaDataSource = await new DataSource({
     nodes: ["localhost:9042"],
    }).initialize("system_schema");

    Here we leverage the using keyword so in the end of the scope on [Symbol.dispose] we automatically close the connection so you don't have to bother.

  3. Create an entity:

    Now we can create a structure that will represent out data.

    @Entity("scylla_tables")
    class ScyllaTables {
      @Column({ name: "name", type: ColumnType.TEXT })
      name: string;
    }
  4. Access the repository:

    You can now get a default repository from the entity.

    const scyllaTablesRepository = scyllaDataSource.getRepository(ScyllaTables);
    
    const tables: Array<ScyllaTables> = await scyllaTablesRepository.find();

You can find more examples in the examples folder.

About

πŸš€ NodeJS ScyllaDB ORM. πŸ§ͺπŸ”§


Languages

Language:TypeScript 91.7%Language:Shell 8.3%