erax.db
    TypeScript icon, indicating that this package has built-in type declarations

    2.9.7 • Public • Published

    Image Image

    Image

    News

    - Fixed Errors.
    - Fixed TypeScript Bugs.
    

    Warn

    - Node.JS version must be greater than 14.
    

    Use

    const { JsonDatabase, YamlDatabase, SqliteDatabase, MongoDatabase } = require("erax.db");
    
    //JSON
    const jsondb = new JsonDatabase({ databasePath: "MyJsonDatabase.json" });
    console.log(JsonDatabase.DBCollection); //It sends all Databases created for Json to the console.
    
    //Yaml
    const yamldb = new YamlDatabase({ databasePath: "MyYamlDatabase.yml", });
    console.log(YamlDatabase.DBCollection); //It sends all Databases created for Yaml to the console.
    
    //SQlite
    const sqlitedb = new SqliteDatabase({ databasePath: "MySqliteDatabase.db" });
    console.log(SqliteDatabase.DBCollection); //It sends all Databases created for Sqlite to the console.
    
    //Mongo
    const mongodb = new MongoDatabase({ mongoURL: "MongoDB URL" });
    console.log(MongoDatabase.DBCollection); //It sends all Databases created for Mongo to the console.

    Methods

    //Set & Fetch Methods
    <db>.set("key", "value")
    <db>.fetch("key")
    <db>.get("key")
    <db>.push("key", "value")
    
    //Delete Methods
    <db>.delete("key")
    <db>.deleteAll()
    <db>.deleteEach("value")
    <db>.findAndDelete((element) => element.ID.includes("test"))
    <db>.destroy()
    <db>.pull("key", "value")
    
    //Exists Methods
    <db>.has("key")
    <db>.arrayHas("key")
    <db>.arrayHasValue("key", "value")
    
    //Array Methods
    <db>.all()
    <db>.fetchAll()
    <db>.startsWith("value")
    <db>.endsWith("value")
    <db>.includes("value")
    <db>.filter((element) => element.ID.startsWith("key"))
    <db>.map((element) => element.ID)
    <db>.keyArray()
    <db>.valueArray()
    
    //Math Methods
    <db>.math("key", "operator", 1)
    <db>.add("key", 1)
    <db>.subtract("key", 1)
    
    //Normal Methods
    <db>.info()
    <db>.size()
    <db>.type("key")
    <db>.DBCollectionSize()
    <db>.getDBName()
    
    //SQLite and Mongo Extra Methods
    await <db>.export("database.json")
    await <db>.import("database.json")
    
    //NOTE: Don't forget to Use await when using methods in Mongo.

    You can reach Emirhan77#0001 on Discord to report a bug.

    Install

    npm i erax.db

    DownloadsWeekly Downloads

    183

    Version

    2.9.7

    License

    Apache-2.0

    Unpacked Size

    105 kB

    Total Files

    17

    Last publish

    Collaborators

    • emirhanbaltas34