vasern / vasern

Vasern is a fast, lightweight and open source data storage for React Native

Home Page:https://vasern.github.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Object and Array data types

kailashvele opened this issue · comments

commented

Hi,

There are use cases when there is a need for storing the whole object. Where the object is received from API and we are not completely aware what kind of data types each key might have with it.

Is there any option for storing Object Data type? I couldn't see it in the documentation.

For eg.

const VasernDB = new Vasern({ schemas: [{ name: "Users", props: { data: "object" } }] });

Welcome to the group, Kai!

At the moment, Vasern doesn't support object type. You can either (1) define a schema for that object and then add a reference, or (2) store as a string using JSON.stringify, thn parse it back as an object using JSON.parse.

commented

Thank You @hieunc229 , Yes by stringifying it can be used.

But are there any plans to add them by default in the future?

@kailashvele No worries! Yes, it will definitely support the object and array natively.
I'm working to release the version soon (in a few months time)

commented

oh Great ! Thanks @hieunc229 .