GraphQL API and utilities for the rpdata project
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
665 B

  1. package services
  2. import (
  3. "git.aiterp.net/rpdata/api/database"
  4. "git.aiterp.net/rpdata/api/services/loaders"
  5. )
  6. // A Bundle contains all services.
  7. type Bundle struct {
  8. Tags *TagService
  9. Characters *CharacterService
  10. Changes *ChangeService
  11. }
  12. // NewBundle creates a new bundle.
  13. func NewBundle(db database.Database) *Bundle {
  14. bundle := &Bundle{}
  15. bundle.Changes = &ChangeService{
  16. changes: db.Changes(),
  17. }
  18. bundle.Tags = &TagService{tags: db.Tags()}
  19. bundle.Characters = &CharacterService{
  20. characters: db.Characters(),
  21. loader: loaders.CharacterLoaderFromRepository(db.Characters()),
  22. changeService: bundle.Changes,
  23. }
  24. return bundle
  25. }