package models // Character is a common data model representing an RP character or NPC. type Character struct { ID string `json:"id" bson:"_id"` Nicks []string `json:"nicks" bson:"nicks"` Name string `json:"name" bson:"name"` ShortName string `json:"shortName" bson:"shortName"` Author string `json:"author" bson:"author"` Description string `json:"description" bson:"description"` } // Nick gets the character's nick. func (character *Character) Nick() *string { if len(character.Nicks[0]) == 0 { return nil } return &character.Nicks[0] } // HasNick gets whether the character has the nick. func (character *Character) HasNick(nick string) bool { for i := range character.Nicks { if nick == character.Nicks[i] { return true } } return false } // IsChangeObject is an interface implementation to identify it as a valid // ChangeObject in GQL. func (*Character) IsChangeObject() { panic("this method is a dummy, and so is its caller") }