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.

48 lines
1.4 KiB

  1. package models
  2. // A Channel represents information abount an IRC RP channel, and whether it should be logged
  3. type Channel struct {
  4. Name string `bson:"_id"`
  5. Logged bool `bson:"logged"`
  6. Hub bool `bson:"hub"`
  7. EventName string `bson:"eventName,omitempty"`
  8. LocationName string `bson:"locationName,omitempty"`
  9. }
  10. func (channel *Channel) ApplyUpdate(update ChannelUpdate) {
  11. if update.Logged != nil {
  12. channel.Logged = *update.Logged
  13. }
  14. if update.Hub != nil {
  15. channel.Hub = *update.Hub
  16. }
  17. if update.EventName != nil {
  18. channel.EventName = *update.EventName
  19. }
  20. if update.LocationName != nil {
  21. channel.LocationName = *update.LocationName
  22. }
  23. }
  24. // IsChangeObject is an interface implementation to identify it as a valid
  25. // ChangeObject in GQL.
  26. func (*Channel) IsChangeObject() {
  27. panic("this method is a dummy, and so is its caller")
  28. }
  29. // ChannelFilter is a filter for channel listing.
  30. type ChannelFilter struct {
  31. Names []string `json:"names"`
  32. Logged *bool `json:"logged"`
  33. EventName *string `json:"eventName"`
  34. LocationName *string `json:"locationName"`
  35. Limit int `json:"limit"`
  36. }
  37. // ChannelUpdate is a filter for channel listing.
  38. type ChannelUpdate struct {
  39. Logged *bool `json:"logged"`
  40. Hub *bool `json:"hub"`
  41. EventName *string `json:"eventName"`
  42. LocationName *string `json:"locationName"`
  43. }