Code Monkey home page Code Monkey logo

vstore's Introduction

VStore - The most lenient way of saving data

If you want to support, you can ⭐ the repo!

FAQ

Where is data stored?

Data is stored in a folder named store located in the current CWD.

What's the point?

To make data syncing easy.

Does it work with TypeScript

It's written in TypeScript, so yes.

Code examples

Examples are written in JavaScript

Setting up stuff

// Lets require the module!
const { VStore } = require("vstorejs");
//or
import { VStore } from "vstorejs";
// Create a store, we have to use
const Name = new VStore({
  name: `Name`, // Required
  memoryCache: true, // Defaults to false, if you want it enabled, set it as true
  json: true, // Defaults to false, if you want it enabled, set it as true
});
// Note, to actually save data you need to have atleast one of the db methods active.

Setting data

const Instance = Name.instance({
  // list your properties here....
  name: `john`, // Grabs type of the property
  sirname: `doe`, // Grabs the type of the property
  fullname: `{name} {sirname}`, // Allows you to replace strings automatically with this.properties, powered by cjays
}); // properties are optional
const Model = Instance.create({
  name: `peter`,
  sirname: `jeff`,
});
// If you don't specify something when creating the model, it will default to the value. Example is when you add name and sirname but not fullname, fullname would be: 'peter jeff'

const Model2 = Instance.create(); // The properties on this would be:
/**
 * name: 'john',
 * sirname: 'doe',
 * fullname: 'john doe'
 *
 */

const Model3 = Instance.create({
  MyCustomProperty: `this isn't listed in the instance`,
});
// Properties on this would be:
/**
 * name: 'john',
 * sirname: 'doe',
 * fullname: 'john doe',
 * MyCustomProperty: 'this isn't listed in the instance'
 */
});

Deleting data

Model.delete();
// or
Name.delete({/* search for things here */ }, index?); // this will call the search method, if you don't specify the index it'll default to 0, it takes in a number!

Updating data

Model.update({ myNewProperty: "hello" });

Features

  • Temporary JSON storage in the store directory
  • Memory cache

Search data

Name.search({ fullname: "john doe" }); // returns an array of items containing documents with fulllname as johndoe

Dependencies

Examples

You can find examples in the github repositors, in the examples directory.

Planned features

Name is an instance of VStore.

Name.duplicate({ searchData }, index?); // returns an instance of a model with duplicated data
Name.update({ serchData }, { newParams }, index?) // updates a model

Support for:

Template: DB_NAME (PLANNED_VERSION_TO_RELEASE)

Example:

MyCoolDB (V4) ^ This means that we plan to add support for MyCoolDB in Version 4 of VStore

  • Postgres (V3.2)
  • MongoDB (V1.1)
  • Redis (V2)
  • SQLite (V3)
  • Quick.DB (V1.2) (I've been requested to add this like 4 times so here you go :( )

Contributing

  • Fork this repo
  • Clone the forked repo
  • CD into the directory
  • git checkout -b my-cool-feature
  • Write some code
  • git add .
  • git commit -m "i want to add a feature"
  • Go to https://github.com/Milo123459/vstore/pulls and create a pull and select your branch

vstore's People

Contributors

dependabot[bot] avatar github-actions[bot] avatar milo123459 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

vstore's Issues

MongoDB Support

Support for MongoDB
We are going to use a MongoDB orm called Mongoose!
It'll be a dev dependncy so you will have to install manuallly by running:

$ npm i mongoose

or

$ yarn add mongoose

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.