Skip to content
This repository has been archived by the owner on Feb 7, 2021. It is now read-only.

Feature: Add functionality to seed data #7

Closed
cmwhited opened this issue Aug 3, 2019 · 5 comments
Closed

Feature: Add functionality to seed data #7

cmwhited opened this issue Aug 3, 2019 · 5 comments
Assignees
Labels
enhancement New feature or request released

Comments

@cmwhited
Copy link
Contributor

cmwhited commented Aug 3, 2019

Is your feature request related to a problem? Please describe.
It would be a nice addition, since this lib is used largely for quick prototyping, to be able to seed some initial data of the generic type for the service.

Describe the solution you'd like
Create a seed method that takes an input: amount: number of how many records to seed (could have default value like 10). Method creates this amount of random records to store in memory to seed the service and provide a basic initial set of data.

@cmwhited cmwhited added the enhancement New feature or request label Aug 3, 2019
@wesleygrimes
Copy link
Member

Interesting idea, in the interim we could add a bulk create method called createMany that would take in an array of T objects. This is probably a broader need as well.

@wesleygrimes
Copy link
Member

@cmwhited I can take this one on, so we are thinking about adding service.seed(10) and randomly generate records?

What are your thoughts about using a library like this one?

https://www.npmjs.com/package/factory.ts

@wesleygrimes wesleygrimes self-assigned this Aug 19, 2019
@cmwhited
Copy link
Contributor Author

Yeah that was my thought. Something like .seed(# of records to seed, default 10). That factory lib looks cool. I say go with it.

@cmwhited
Copy link
Contributor Author

And, going back to the forFeature & forRoot discussion, the # of records could be part of the config so when the service is instantiated, it could seed the records based on the config.

wesleygrimes added a commit that referenced this issue Aug 21, 2019
Add need seed method on InMemoryDBService with ability to set amount and record factory for
generation.

impl #7
wesleygrimes added a commit that referenced this issue Aug 22, 2019
Add need seed method on InMemoryDBService with ability to set amount and record factory for
generation.

impl #7
wesleygrimes added a commit that referenced this issue Aug 22, 2019
Add new seed method to InMemoryDBService

Closes #7
wesleygrimes added a commit that referenced this issue Aug 22, 2019
Add new seed method to InMemoryDBService

Closes #7
@wesleygrimes
Copy link
Member

🎉 This issue has been resolved in version 1.5.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request released
Projects
None yet
Development

No branches or pull requests

2 participants