Giter Club home page Giter Club logo

node-testdata-generator's People

Contributors

greenkeeper[bot] avatar mauricenino avatar

Watchers

 avatar

node-testdata-generator's Issues

Change the way the program works

Change it to match the following process:

  1. generation of single testdata
  2. add referenceKeys to map
    Format: key => values [IGeneratedFieldValue, ...]
  3. add referenceTo to second map; paths is the path where one random element of values gets put in
    Format: toKey => paths Set["object>prop>prop"]
  4. transform single testdata to real json
  5. save bulk of data (~10000 generated fields, depending on field size) to single sqlite row

repeat for all

  1. resolve keys of single bulk of testdata

repeat for all

  1. transform single bulk of data
  2. save bulk to file if specified and delete bulk from db

repeat for all

  1. output bulk to cmd if specified and delete bulk from db

repeat for all

This should increase the performance and reduce the RAM/Disk usage due to way smaller data.

This is the old format in that it is saved:

export interface IGeneratedCollection {
    dbName: string,
    collectionName: string,
    documents: IGeneratedDocument[]
}

export interface IGeneratedDocument {
    documentFields: IGeneratedField []
}

export interface IGeneratedField {
    fieldName: string,
    fieldValue: any,
    fieldNeedsQuotations?: boolean,
    fieldIsObject?: boolean,
    fieldIsJsonObject?: boolean,
    fieldIsArray?: boolean,
    unboxElements?: boolean,
    referenceKey?: number,
    referenceTo?: number
}

Which would result in a example code of this - and there aren't even any sub objects, arrays, references, ...:

{
    "dbName": "db",
    "collectionName": "users",
    "documents": [
        {
            "documentFields": [
                {
                    "fieldName": "Name",
                    "fieldValue": "Hans Peter",
                    "fieldNeedsQuotations": true
                },
                {
                    "fieldName": "Age",
                    "fieldValue": 23,
                    "fieldNeedsQuotations": false
                }
            ]
        }
    ]
}

By saving it with real JSON format it looks like this:

{
    "dbName": "db",
    "collectionName": "users",
    "documents": [
        {"Name": "Hans Peter", "Age": 23}
    ]
}

Obviously some information gets lost there, but the information is only needed for reference resolving and parsing to JSON. So if we extract the reference Information to extra HashMaps, we can directly transform it into real JSON and save about 2/3 of space.

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.