Giter Club home page Giter Club logo

mycro-db's Introduction

Olá, sou o Diego Queiroz

Um pouco sobre mim

  • Sou uma pessoa que descobriu a paixão por tecnologia e desenvolvimento de software, que ainda não conseguiu se organizar para estudar em uma graduação. Porém, estou diariamente estudando Python e Javascript, além de algoritmos e tópicos gerais de programação.

  • Tenho buscado interagir, principalmente auxiliando nas dúvidas e problemas, com várias pessoas, em diversas comunidades (como a SouJunior Lab e He4rt), além de grupos em Telegram e WhatsApp. E no futuro, quero oficializar minha atividade como Professor de Programação.

  • Meu projeto de maior orgulho (e meu primeiro), é o Sistema de Estoque e Vendas, que desenvolvi voluntariamente, para uma loja em minha cidade. Foi muito interessante, abordar o dono da loja, oferecendo a modernização no 'Excel' que ele usava.

Me encontre em

Informações do GitHub

   

mycro-db's People

Contributors

diegiwg avatar

Stargazers

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

Watchers

 avatar  avatar

Forkers

wouerner

mycro-db's Issues

Feature: Choose ID type

From what I understand, it is not possible to choose the 'type' of data that will be used as an ID in a given collection. I would like this possibility to be added to the API.

Another thing, looking at the code that generates the collection, I saw that it 'automatically' / 'forcibly' attaches the Document ID to its record. Although I haven't messed up anything so far, I believe that doing this without the programmer explicitly stating that he wants to do so is shooting himself in the foot.

Anyway, I would like to have the choice of what type of data I will have as an ID, and for this automated ID system in the Document to be replaced by something less intrusive.

Proposal: index system

Reading the Readme I found that one of the future plans is to create the index system.

Thinking a little, I believe I came up with a good basis for the system:

API

import { MemoryStorage, MycroDatabase } from 'mycro-db';

const storage = new MemoryStorage();
const db = new MycroDatabase(inMemoryStorage);

const User = db.collection('users', {
    name: String(),
    age: Number()
});
User.index('name');

User.insert([{
        name: 'Alice',
        age: 28
    },
    {
        name: 'Bob',
        age: 30
    }
]);

OBJECT

{
  collections: {
    users: {
      id: 2,
      documents: [
          { id: 1, name: 'Alice', age: 28 },
          { id: 2, name: 'Bob', age: 30 }
      ],
      indexes: {
        // REF: [key]: (value, id)[]
        name: [
          ('Alice', 1),
          ('Bob', 2)
        ]
      }
    }
  }
}

In summary, in addition to CRUD commands, the Collections API can offer a command to create an INDEX under a KEY that you have in your documents.

As MycroDB is not concerned with maintaining something structured, the system can be flexible, and in documents inserted into the collection that do not have the key that is treated as an index, it simply ignores it.

In the same meantime, it would be necessary to rewrite part of the functions to deal with indices. Perhaps in addition to GET by id, it will be possible to have a GET by index. And change the QUERY to search in indexes?

Anyway, I believe that the approximation above is very good for the current MycroDB API.

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.