npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

myscl-client

v0.1.5

Published

A simple client to connect to a MySCL database.

Downloads

22

Readme

MySCL Client

What is MySCL Client?

The MySCL Client is made for projects to be able to use the MySCL Server, refer to the server here.

This document lists all the possible functions, and even the simple caching capabilities.

Installation Process

Run the following command below in a new project to install the client.

npm i myscl-client

Database Documentation

createDB

The createDB function creates a database on the server, the function accepts a name that names the database.

function createDB(dbname)

Here is a basic implementation of the createDB function and the implications. The basic implementation is listed below.

const { MySCL } = require("myscl-client")
const db = new MySCL("host", "port", "username", "password")

async function run() {
    await db.createDB("website")
}

run()

createCollection

The createCollection function creates a subcategory in a database which is a collection. The function accepts arguments of the dbname that the collection is created in and the cname which is the name of the collection.

function createCollection(dbname, cname)

Here is a basic implementation of the createCollection function and the implications. The basic implementation is listed below.

const { MySCL } = require("myscl-client")
const db = new MySCL("host", "port", "username", "password")

async function run() {
    await db.createCollection("website", "collection")
}

run()

deleteDB

The deleteDB function simply deletes a database using the argument dbname. This function deletes a database if it exists.

function deleteDB(dbname)

Here is a basic implementation of the deleteDB function, and the implications. The basic implementation is listed below.

const { MySCL } = require("myscl-client")
const db = new MySCL("host", "port", "username", "password")

async function run() {
    await db.deleteDB("website")
}

run()

deleteCollection

The deleteCollection function deletes a collection in a database if it exists. The deleteCollection function accepts a argument of a dbname and cname.

function deleteCollection(dbname, cname)

Here is a basic implementation of the deleteCollection function, and the implications. The basic implementation is listed below.

const { MySCL } = require("myscl-client")
const db = new MySCL("host", "port", "username", "password")

async function run() {
    await db.deleteCollection("website", "collection")
}

run()

readAllDatabases

The readAllDatabases function returns an array of all the databases on the server. The command accepts no arguments.

function readAllDatabases()

Here is a basic implementation of the readAllDatabases function, and the implications. The basic implementation is listed below.

const { MySCL } = require("myscl-client")
const db = new MySCL("host", "port", "username", "password")

async function run() {
    const databases = await db.readAllDatabases()
    console.log(databases)
}

run()

readAllCollections

The readAllCollections function returns an array of all the collections in a given database. The function accepts an argument of a dbname.

function readAllCollections(dbname)

Here is a basic implementation of the readAllCollections function, and the implications. The basic implementation is listed below.

const { MySCL } = require("myscl-client")
const db = new MySCL("host", "port", "username", "password")

async function run() {
    const collections = await db.readAllCollections("website")
    console.log(collections)
}

run()

insertOne

The insertOne function inserts a object in a collection (document). The function accepts a few arguments including a dbname, cname, and a value of an object that is inserted into the collection.

function insertOne(dbname, cname, value)

Here is a basic implementation of the insertOne function, and the implications. The basic implementation is listed below.

const { MySCL } = require("myscl-client")
const db = new MySCL("host", "port", "username", "password")

async function run() {
    await db.insertOne("website", "collection", { name: "thing", random: 123 })
}

run()

insertMany

The insertMany function inserts multiple object in a collection (document). The function accepts a few arguments including a dbname, cname, and a value of an array with objects inside that is inserted into the collection.

function insertMany(dbname, cname, value)

Here is a basic implementation of the insertOne function, and the implications. The basic implementation is listed below.

const { MySCL } = require("myscl-client")
const db = new MySCL("host", "port", "username", "password")

async function run() {
    await db.insertMany("website", "collection", [
        { name: "thingy", random: 123 },
        { name: "thingy", random: 456 },
        { name: "asdf", random: 789 }
    ])
}

run()

findOne

The findOne function returns an object that is searched. It searches in a given collection in a database. The findOne arguments has arguments of a dbname, a cname, and a search object.

function findOne(dbname, cname, search)

Here is a basic implementation of the findOne function, and the implications. The basic implementation is listed below.

const { MySCL } = require("myscl-client")
const db = new MySCL("host", "port", "username", "password")

async function run() {
    const search = await db.findOne("website", "collection", { name: "thingy" })
    console.log(search) // { name: "thingy", random: 123 }
}

run()

findMany

The findMany function returns an array of objects depending on the search and collection It searches based off of a search object in a given collection in a database. The findMany functions has arguments of a dbname, a cname, and a search object.

function findMany(dbname, cname, search)

Here is a basic implementation of the findMany function, and the implications. The basic implementation is listed below.

const { MySCL } = require("myscl-client")
const db = new MySCL("host", "port", "username", "password")

async function run() {
    const search = await db.findMany("website", "collection", { name: "thingy" })
    console.log(search) // [ { name: "thingy", random: 123 }, { name: "thingy", random: 456 } ]
}

run()

deleteOne

The deleteOne function deletes only one object in a collection with a search object. The deleteOne function has arguments of a dbname, a cname, and a search object.

function deleteOne(dbname, cname, search)

Here is a basic implementation of the deleteOne function, and the implications. The basic implementation is listed below.

const { MySCL } = require("myscl-client")
const db = new MySCL("host", "port", "username", "password")

async function run() {
    await db.deleteOne("website", "collection", { random: 123 })
}

run()

deleteMany

The deleteMany function deletes many objects based on a search object in a given collection. The arguments that this function accepts are a dbname, a cname, and lastly a search object.

function deleteMany(dbname, cname, search)

Here is a basic implementation of the deleteMany function, and the implications. The basic implementation is listed below.

const { MySCL } = require("myscl-client")
const db = new MySCL("host", "port", "username", "password")

async function run() {
    await db.deleteMany("website", "collection", { name: "thingy" })
}

run()

Caching Documentation

COMING SOON! COMING SOON! COMING SOON! COMING SOON! COMING SOON!