Guest User

Untitled

a guest
Jul 17th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. //QueryRepo provides methods for retrieving Users.
  2. type QueryRepo interface {
  3. //Get should return the User whose Id equals id.
  4. //
  5. //An error should be returned if the User does not exist or there was an error
  6. //attempting to load the User.
  7. Get(ctx context.Context, id data.Id) (*User, error)
  8.  
  9. //GetEmail should return the User whose Email equals email.
  10. //
  11. //An error should be returned if the User does not exist or there was an error
  12. //attempting to load the User.
  13. GetEmail(ctx context.Context, email string) (*User, error)
  14.  
  15. //List should return all Users in the application.
  16. //They should be sorted by their lexicographic Email order.
  17. List(ctx context.Context) ([]*User, error)
  18. }
  19.  
  20. //Repo provides method for creating and updating Users
  21. //as well as promotes the QueryRepo interface.
  22. type Repo interface {
  23. //QueryRepo is promoted here to indicate a Repo contains all query methods.
  24. QueryRepo
  25.  
  26. //Add should add u to the underlying storage repository.
  27. Add(ctx context.Context, u User) error
  28.  
  29. //Set should update all stored fields of u in the underlying storage repository.
  30. //The update should use u.Id for determining which entity to update.
  31. Set(ctx context.Context, u User) error
  32. }
Add Comment
Please, Sign In to add comment