Giter Club home page Giter Club logo

newtondb's Introduction

GitHub npm Twitter LinkedIn YouTube

πŸ‘‹ Introduction

Hi there. My name is Alex Berriman and I'm a software engineer from Sydney, Australia.

I'm currently working mainly with Typescript and Node.js. Repository wise my profile is fairly empty, but it should start filling up as I start open sourcing some projects I've been working on over the years.

πŸ’‘ Projects

  • Newton: A simple, easy to use and extendible JSON database.

✨ About me

  • Massive πŸ€“ for anything to do with space and cosmology.
  • Write code to support my spearfishing habit.
  • Love a 🍺 and a chat - hit me up.

πŸ“« Contact me

Twitter | Youtube | LinkedIn | βœ‰οΈ Email | πŸ’¬ Issue Me about everything!

newtondb's People

Contributors

alexberriman avatar semantic-release-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

gribias

newtondb's Issues

The automated release is failing 🚨

🚨 The automated release from the main branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you can benefit from your bug fixes and new features again.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can fix this πŸ’ͺ.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the main branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here are some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


Missing package.json file.

A package.json file at the root of your project is required to release on npm.

Please follow the npm guideline to create a valid package.json file.


Good luck with your project ✨

Your semantic-release bot πŸ“¦πŸš€

Remove lodash

Remove the dependency on lodash. Only a few functions are used - fairly unnecessary.

Sort keys

Will improve performance on read operations. Records that are stored pre-sorted can be returned a lot more efficiently as opposed to sorting the entire linked list each query.

Secondary indexes

Currently, an index is only created for the primary key of a collection. That means for every other query where the primary key is not included, the entire collection has to be scanned. If you were able to configure multiple secondary indexes, read operations could reference the hash table as opposed to scanning the linked list.

Query caching

If executing the same query and know that the data source hasn't changed, should be able to return a cached result.

Not filter

Add the ability to use not as a query filter.

e.g.

{
  "not": {
    "property": "nationality",
    "operator": "endsWith",
    "value": "ian"
  }
}

Can not mutate/add values to an array

Description

When trying to add values to an array the value isn't mutated.

e.g. you would expect this test to pass:

it("updates an empty array", () => {
  const $ = new Collection<{
    color: string;
    contents: string[];
    animal: string;
  }>(
    [
      { color: "green", contents: ["apple"], animal: "gorilla" },
      { color: "red", contents: [], animal: "monkey" },
    ],
    { primaryKey: "color" }
  );

  $.get({ color: "red" })
    .set({ contents: ["orange", "banana"], animal: "giraffe" })
    .commit();

  expect($.get({ color: "red" }).data).toEqual({
    animal: "giraffe",
    color: "red",
    contents: ["orange", "banana"],
  });
});

However after mutation the value of contents is still an empty array.

Type docs

Add typedocs and host on Github pages.

S3 adapter

Read/write a JSON file from Amazon's S3 object storage. This will most likely be released in a separate package not part of the core.

Deleting an element from an array sets it to `null` instead

When you try and delete an element from an array, rather than delete it just sets it to null

interface Lunchbox {
  color: string;
  contents: string[];
}
const $db = new Database<Lunchbox[]>([
  { color: "red", contents: ["apple", "orange", "banana"] },
]);
const $patch = $db.$.get({ color: "red" })
  .set({ contents: ["orange", "banana"] })
  .commit();
console.log(JSON.stringify($db.$.get({ color: "red" }).data));

// => {"color":"red","contents":[null,"orange","banana"]}

.upsert

Have the ability to insert multiple records at a time.

Should have at minimum the following options:

  • onDuplicate?: "skip" | "replace" | "merge"

Where:

  • skip: new item is ignored
  • replace: old item is replaced with the new item
  • merge: new item is merged into the old item

`.orderBy` not working with `.limit()` and `.offset()`

Description

When you try to order a collection in conjunction with .limit() and .offset(), the ordering is applied after the results of limit/offset.

i.e. with the following data:

const wizards: Wizard[] = [
  { id: 1, name: "harry", house: "gryffindor", born: 1980, married: true },
  { id: 2, name: "hermione", house: "gryffindor", born: 1979, married: false },
  { id: 3, name: "ron", house: "gryffindor", born: 1980, married: false },
  { id: 4, name: "draco", house: "slytherin", born: 1980, married: true },
];

You would expect the following to pass:

const $ = new Collection(wizards);

expect($.orderBy({ id: "desc" }).offset(0).limit(2).data).toMatchObject([
  { id: 4, name: "draco" },
  { id: 3, name: "ron" },
]);

However it returns hermione and then harry.

JSON Schema

Description

Would be good to be able to accept as input a JSON schema and get a functional database.

Features:

  • Full type hinting
  • Option to validate (would also be a good option more generally)

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.