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.
|
|
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 }
|