New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support persistent and serializable flags #432

Closed
ritch opened this Issue Feb 5, 2015 · 6 comments

Comments

Projects
None yet
10 participants
@ritch
Copy link
Member

ritch commented Feb 5, 2015

{
  type: 'string',
  persistent: true, // default true (persisted into db)
  serializable: true // default true (serialized into json)
}

persisted - only stored using the connector if true or undefined

serializable - if false the value will not be included in .toJSON() result

@raymondfeng @bajtos @fabien

@bajtos

This comment has been minimized.

Copy link
Member

bajtos commented Feb 6, 2015

👍

IIRC there are quite few older issues and mailing list threads that will be resolved once this is implemented. It would be nice to find them and link them to this story.

@clarkorz

This comment has been minimized.

Copy link
Contributor

clarkorz commented Feb 6, 2015

@ritch ritch added the #plan label Feb 19, 2015

@chandadharap chandadharap added #tob and removed #plan labels Feb 19, 2015

@raymondfeng

This comment has been minimized.

Copy link
Member

raymondfeng commented Mar 9, 2015

I would like to make the property configuration more flexible as follows:

For JSON mapping:

"myProp": {
  "type": "string",
  "json": {
    "in": true,
    "out": true,
    "name": "my-prop"
  }
}

Please note that "json" is consistent with DB specific mappings such as "mysql".

  • in - The property can be deserialized from the JSON object (I'm open to deserializable too)
  • out - The property can be serialized into the JSON object (I'm open to serializable too)
  • name - The custom name for the property in JSON. (I see the need to map myProp to my-prop in some cases).

A few shortcuts:

  1. "json": false === "json": {"in": false, "out": false, "name": "myProp"}
  2. "json": "my-prop" === "json": {"in": true, "out": true, "name": "my-prop"}
  3. undefined === "json": {"in": true, "out": true, "name": "myProp"}

For persistence mapping:

"myProp": {
  "type": "string",
  "persistence": {
    "in": true,
    "out": true,
    "name": "my-prop"
  }
}
  • in - The property can be loaded from DB (I'm open to deserializable too)
  • out - The property can be saved into DB (I'm open to serializable too)
  • name - The custom name for the property in DB. (I see the need to map myProp to my-prop in some cases).

Please note "persistence" can be used to define common DB mappings for all DB types. Similar shortcuts are supported as for JSON.

@raymondfeng raymondfeng added #plan and removed #tob labels Mar 9, 2015

@bajtos

This comment has been minimized.

Copy link
Member

bajtos commented Mar 10, 2015

Sounds good 👍

An alternative naming: json -> transport, persistence -> storage. Just an idea to consider, the current proposal is ok.

@chandadharap chandadharap added #tob and removed #plan labels Mar 10, 2015

@seriousben

This comment has been minimized.

Copy link

seriousben commented Mar 10, 2015

This is great! Thanks

@chandadharap chandadharap added #plan and removed #tob labels May 28, 2015

@cgole cgole removed ease-of-use labels Jan 7, 2017

@0candy 0candy added the feature label Mar 15, 2017

@siddhipai siddhipai added the backlog label Mar 27, 2017

@stale stale bot added the stale label Aug 23, 2017

@stale stale bot closed this Sep 6, 2017

@0candy 0candy removed the backlog label Sep 6, 2017

@stale

This comment has been minimized.

Copy link

stale bot commented Sep 6, 2017

This issue has been closed due to continued inactivity. Thank you for your understanding. If you believe this to be in error, please contact one of the code owners, listed in the CODEOWNERS file at the top-level of this repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment