platform/packages/relations
2021-06-26 21:13:43 +08:00
..
lib Removed redundant code 2021-06-26 21:13:43 +08:00
test Removed redundant code 2021-06-26 21:13:43 +08:00
.gitignore Add 'packages/relations/' from commit 'f1d7081f462d497a1d5810356132867158379e79' 2020-02-15 18:44:01 -05:00
.travis.yml Add 'packages/relations/' from commit 'f1d7081f462d497a1d5810356132867158379e79' 2020-02-15 18:44:01 -05:00
analysis_options.yaml Merged from sdk-2.12.x_nnbd 2021-06-20 20:37:20 +08:00
AUTHORS.md Merged from sdk-2.12.x_nnbd 2021-06-20 20:37:20 +08:00
CHANGELOG.md Merged from sdk-2.12.x_nnbd 2021-06-20 20:37:20 +08:00
LICENSE Merged from sdk-2.12.x_nnbd 2021-06-20 20:37:20 +08:00
pubspec.yaml Merged from sdk-2.12.x_nnbd 2021-06-20 20:37:20 +08:00
README.md Add 'packages/relations/' from commit 'f1d7081f462d497a1d5810356132867158379e79' 2020-02-15 18:44:01 -05:00

relations

version 1.0.1 build status

Database-agnostic relations between Angel services.

// Authors owning one book
app.service('authors').afterAll(
    relations.hasOne('books', as: 'book', foreignKey: 'authorId'));

// Or multiple
app.service('authors').afterAll(
    relations.hasMany('books', foreignKey: 'authorId'));

// Or, books belonging to authors
app.service('books').afterAll(relations.belongsTo('authors'));

Supports:

  • hasOne
  • hasMany
  • hasManyThrough
  • belongsTo
  • belongsToMany