-
Notifications
You must be signed in to change notification settings - Fork 4
ormjs: Edge collection modelling #4
Copy link
Copy link
Open
Description
Hi, I'd like to work a bit on this package. I've forked it at https://github.com/OKNoah/ormjs.
I'm pretty new to ArangoDB.
I'd like to try add support for modelling edge collections. I believe this is done by var actsIn = db._createEdgeCollection("actsIn"); in the javascript driver, as seen here: https://github.com/arangodb/Cookbook/blob/master/recipes/Graph/ExampleActorsAndMovies.md
I'm just thinking of the syntax now. Open to suggestions. Perhaps like this.
import Model, { Edge } from './db'
/* A User lives at an Address */
export default class LivesAt extends Edge {
static schema = {
created: Date
}
}
export default class User extends Model {
static schema = {
name: String,
created: Date
}
}
export default class Address extends Model {
static schema = {
street: String,
city: String
}
}
const user = await User.add({
name: 'Will',
created: Date()
})
const address = await Address.add({
city: 'Bel Air'
})
const relationship = await LivesAt.add(user, address)
user.save()
address.save()
relationship.save()Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels