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

package models
// A Channel represents information abount an IRC RP channel, and whether it should be logged
type Channel struct {
Name string `bson:"_id"`
Logged bool `bson:"logged"`
Hub bool `bson:"hub"`
EventName string `bson:"eventName,omitempty"`
LocationName string `bson:"locationName,omitempty"`
}
func (channel *Channel) ApplyUpdate(update ChannelUpdate) {
if update.Logged != nil {
channel.Logged = *update.Logged
}
if update.Hub != nil {
channel.Hub = *update.Hub
}
if update.EventName != nil {
channel.EventName = *update.EventName
}
if update.LocationName != nil {
channel.LocationName = *update.LocationName
}
}
// IsChangeObject is an interface implementation to identify it as a valid
// ChangeObject in GQL.
func (*Channel) IsChangeObject() {
panic("this method is a dummy, and so is its caller")
}
// ChannelFilter is a filter for channel listing.
type ChannelFilter struct {
Names []string `json:"names"`
Logged *bool `json:"logged"`
EventName *string `json:"eventName"`
LocationName *string `json:"locationName"`
Limit int `json:"limit"`
}
// ChannelUpdate is a filter for channel listing.
type ChannelUpdate struct {
Logged *bool `json:"logged"`
Hub *bool `json:"hub"`
EventName *string `json:"eventName"`
LocationName *string `json:"locationName"`
}