0.4.1 โ€ข Published 12 months ago

@lambda-group/charydbis v0.4.1

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months ago

๐Ÿ“ฅ 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 a model:

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

    @Model("scylla_tables")
    class ScyllaTables {
      @Column()
      name: string;
    }
  4. Access the repository:

    You can now get a default repository from the model.

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

You can find more examples in the examples folder.

0.4.1

12 months ago

0.4.0

12 months ago

0.3.0

1 year ago

0.2.0

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago