Socket
Socket
Sign inDemoInstall

aoi.db

Package Overview
Dependencies
1
Maintainers
2
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

aoi.db

aoi.db - Database Management System with different types of databases.


Version published
Maintainers
2
Weekly downloads
337
increased by105.49%

Weekly downloads

Readme

Source

aoi.db

Discord Server NPM Downloads NPM Version

Table Of Contents

About

Aoi.db is a collection of various database types to handle various types of data requirements!

Installation

#npm 
npm i aoi.db

#yarn
yarn add aoi.db

#edge

npm i https://github.com/leref/aoi.db#main

Types

  • KeyValue - A simple database that stores key value pairs
    • Usage: general purpose
  • WideColumn - A database that stores data in a column
    • Usage: good for getting separate columns related to a primary column
  • Remote - A database that stores data in a remote server
    • Usage: good for separating database extensive usage from main project/process

Setups

KeyValue

  const { KeyValue } = require("aoi.db") //commonjs
  // or
  import { KeyValue } from "aoi.db" //esm

  // Basic Setup
  const db = new KeyValue({
    path: "./path/",
    tables: ["table"],
  });

  db.on("ready", () => {
    console.log("Database is ready!");
  });

  db.connect();

Reference: KeyValue

WideColumn

  const { WideColumn, Column } = require("aoi.db") //commonjs
  // or
  import { WideColumn, Column } from "aoi.db" //esm

  // Basic Setup

  const prime = new Column({
    name: "id",
    primary: true,
    type: "bigint",
    default:0n,
  });
  const xp = new Column({
    name: "xp",
    type: "number",
    primary: false,
    sortOrder: "DESC",
    default : 0,
  });

  const db = new WideColumn({
    path: "./path/",
    encryptOption: {
      securitykey: "a-32-characters-long-string-here",
    },
    tables: [
      {
        name: "main",
        columns: [prime, xp ],
      },
    ],
  });

  db.on("ready", () => {
    console.log("Database is ready!");
  });

  db.connect();

Reference: WideColumn

Remote

Setting up the database server
const { Receiver } = require("aoi.db"); //commonjs
// or
import { Receiver } from "aoi.db"; //esm

const rec = new Receiver({
  logEncrypt: "a-32-characters-long-string-here",
  logPath: "./logPath/",
  wsOptions: {
    port: portNo, // 443 for ssl wss and 80 for ws
    clientTracking: true,
  },
  whitelistedIps: "*",
});

rec.on("connect", () => {
  console.log("connected");
});

rec.connect();

Reference: Receiver

Setting up the client

const { Transmitter, TransmitterFlags } = require("aoi.db"); //commonjs
// or
import { Transmitter, TransmitterFlags } from "aoi.db"; //esm

const db = new Transmitter({
  path: "websocket path",
  //path : "ws://localhost:80",
  databaseType: "KeyValue or WideColumn",
  dbOptions: {
    path: "./databasePath in remote server/",
    encryptOption: {
      securitykey: "a-32-characters-long-string-here",
      enabled: true,
    },
  },
  name: "username",
  pass: "password",
  flags: TransmitterFlags.READ_WRITE, //READ_WRITE, READ_ONLY, WRITE_ONLY
  tables: ["table"],
});

db.on("ready", () => {
  console.log("ready");
});
db.on("close", (code, reason) => {
  console.log("[TRANSMITTER] => " + code + " " + reason);
});
db.connect();

Reference: Transmitter

Keywords

FAQs

Last updated on 16 Jun 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc