Code Monkey home page Code Monkey logo

database-node's Introduction

npm version

Run on Repl.it

Repl.it Database client

Repl.it Database client is a simple way to use Repl.it Database in your Node.js repls. It uses await/async.

Get started

const Client = require("@replit/database");
const client = new Client();
await client.set("key", "value");
let key = await client.get("key");
console.log(key);

Docs

class Client(String key?)

The key is the optional custom URL.

Native Functions

These functions are specified in the repl.it DB.

get(String key, Object options?)

Gets a key. Returns Promise.

client.get("key", { raw: false }).then(console.log);

set(String key, Any value)

Sets a key to value. Returns Client.

delete(String key)

Deletes a key. Returns Client.

list(String? prefix)

Lists all of the keys, or all of the keys starting with prefix if specifed.

Dynamic Functions

These functions have been added by me.

empty()

Clears the database. Returns Client

getAll()

Get all key/value pairs and return as an object.

setAll(Object obj)

Sets the entire database through a key/value object. Returns Client

deleteMultiple(...String args)

Deletes multiple keys. Returns client.

Tests

npm i
npm run test

database-node's People

Contributors

mrlapizgithub avatar masad-frost avatar brenoafb avatar cdmistman avatar jnnnthnn avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.