1.2.5 • Published 5 years ago
dgraph-orm v1.2.5
dgraph-orm
Simplified schema creation, queries and mutations for Dgraph.
Installation
npm install dgraph-orm
Full Documentation
https://ashokvishwakarma.github.io/dgraph-orm
Your first schema and model
import dgraph from 'dgraph-orm';
const UserSchema = new dgraph.Schema('user', {
name: {
type: dgraph.Types.STRING,
index: true,
token: {
term: true
}
},
email: {
type: dgraph.Types.STRING,
index: true,
unique: true,
token: {
exact: true
}
},
password: dgraph.Types.PASSWORD,
bio: dgraph.Types.STRING,
friend: {
type: dgraph.Types.UID,
model: 'user', // related model name
count: true,
reverse: true
}
});
/**
* Set and create model out of the schema
*/
const User = dgraph.model(UserSchema);
/**
* Creates a new user with passed fields
*
* Returns the created user along with the generated uid
*/
const user = await User.create({
name: 'Ashok Vishwakarma',
email: 'akvlko@gmail.com',
bio: 'My bio ...'
});
console.log(user);
// {
// uid: '0x1',
// name: 'Ashok Vishwakarma',
// email: 'akvlko@gmail.com',
// bio: 'My bio ...'
// }
For the full documentation please visit the below link
https://ashokvishwakarma.github.io/dgraph-orm
Futute releases
- Other geo queries within, intersects
- Group by
- Aggregation
Contribution
Issues and pull requests are welcome for
- Unit test cases
- Feature and query method implementation
- Bug fixes
Author
Ashok Vishwakarma
1.2.5
5 years ago
1.2.4
5 years ago
1.2.3
5 years ago
1.2.2
5 years ago
1.2.1
5 years ago
1.2.0
5 years ago
1.1.9
5 years ago
1.1.8
5 years ago
1.1.7
5 years ago
1.1.6
5 years ago
1.1.5
5 years ago
1.1.4
5 years ago
1.1.3
5 years ago
1.1.2
5 years ago
1.1.1
5 years ago
1.0.10
5 years ago
1.1.0
5 years ago
1.0.9
5 years ago
1.0.8
5 years ago
1.0.7
5 years ago
1.0.6
5 years ago
1.0.5
5 years ago
1.0.4
5 years ago
1.0.3
5 years ago
1.0.2
5 years ago
1.0.1
5 years ago
1.0.0
5 years ago