Comments (5)
What are your expectations due to inheritance? How it should be affected in persistence? In relational database we can create new table for inherited class with relation 'belongs to' or 'has one'. This table will only contain attributes for child class.
To be honest, I don't like this idea. Inheritance for persistent classes increases difficulty badly, IMHO.
Let's discuss.
from jugglingdb.
My use case is what I described with Transaction.
- Transaction
- FreeTransaction
- PaypalTransaction
Exact same fields, but the behaviors change.
Maybe it can be done as a mixin or something, but the obvious way is to inherit.
from jugglingdb.
I have a similar requirement. I have several schemas that look similar to the following:
Channel = {
name: String,
description: String,
type: String,
url: String,
timeout: Number
}
ConfiguredChannel = {
channel: Channel,
timeout: Number
}
ChannelSet = {
name: String,
description: String,
configuredChannels: [ConfiguredChannel]
}
ConfiguredChannelSet = {
channelSet: ChannelSet,
startTime: Number
}
Display = {
name: String,
configuredChannelSets: [ConfiguredChannelSet]
}
I'd like ConfiguredChannel
s to inherit their parent's attributes, like timeout
. If no timeout
is specified on the ConfiguredChannel
, I'd use something like a pre-save hook to inherit that property from the parent. ChannelSet
s are comprised of ConfiguredChannel
s and a few other properties. Different Display
s can reuse several predefined ConfiguredChannelSet
s but specify their startTime
.
Maybe I'm modeling my data incorrectly — but this schema seems to "feel" right.
from jugglingdb.
I think this feature is not for schema definition internals, you can do some inheritance outside, like $.extend in jquery: define some "abstract" attributes set and reuse it for different model definitions.
from jugglingdb.
This issue should be implemented. Yeah its really hairy, but other popular ORMs have it (hibernate, active record). For instance, people might want their hierarchy to share an ID namespace. This is more than just using $.extend to save code. That being said, I realize its a huge complexity overhead
from jugglingdb.
Related Issues (20)
- README documentation references are not reachable
- is this project dead ? HOT 5
- Potentially unhandled rejection [2] TypeError, when upgrading to new version of node. HOT 1
- Site down HOT 2
- Support multiple hooks per action
- Validations should be revisited
- Deprecate mutation features
- Consider removing all instance methods
- Disallow mixins on Model
- Model relations
- how to query field in multiple values? HOT 1
- Can i use JugglingDB in production? HOT 4
- process rpc message error TypeError: User.bulkUpdate is not a function HOT 2
- How can i delete one record ?
- Is this project maintained? HOT 2
- How to get the table definition from a datasource?
- upsert method doesn't trigger any hooks for mysql adapter HOT 3
- In
- Use in production? HOT 2
- Composite primary keys / composite foreign keys
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jugglingdb.