Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Character ¶
type Character struct { ID int64 `gorm:"primary_key;AUTO_INCREMENT"` Name string `gorm:"unique"` DateCreated time.Time `gorm:"column:date_created;type:datetime;not null"` LastUpdated time.Time `gorm:"column:last_updated;type:datetime;not null"` }
Character represents a character that may own phrases
type CharacterCommand ¶
type CharacterCommand struct {
Name string `json:"name" binding:"required"`
}
CharacterCommand contains the info to create a Character
func NewCharacterCommand ¶
func NewCharacterCommand(name string) CharacterCommand
NewCharacterCommand is a constructor for CharacterCommand
type CharacterResult ¶
type CharacterResult struct { ID int64 `json:"id"` Name string `json:"name"` DateCreated *utils.ISO8601Time `json:"date_created"` LastUpdated *utils.ISO8601Time `json:"last_updated"` }
CharacterResult is the type to be shown in the API for a Character
func CharacterResultFromCharacter ¶
func CharacterResultFromCharacter(ch Character) CharacterResult
CharacterResultFromCharacter creates a CharacterResult from a Character
func NewCharacterResult ¶
func NewCharacterResult(id int64, name string, dateCreated *utils.ISO8601Time, lastUpdated *utils.ISO8601Time) CharacterResult
NewCharacterResult is a constructor for CharacterResult
type Phrase ¶
type Phrase struct { ID int64 `gorm:"primary_key;AUTO_INCREMENT"` CharacterId int64 Character *Character `gorm:"foreignkey:CharacterId"` Content string DateCreated time.Time `gorm:"column:date_created;type:datetime;not null"` LastUpdated time.Time `gorm:"column:last_updated;type:datetime;not null"` }
Phrase represent a phrase from one character
type PhraseCommand ¶
type PhraseCommand struct { CharacterId int64 `json:"character_id"` Content string `json:"content" binding:"required"` }
PhraseCommand contains the info to create a phrase
func NewPhraseCommand ¶
func NewPhraseCommand(content string) PhraseCommand
NewPhraseCommand is a constructor for PhraseCommand
type PhraseResult ¶
type PhraseResult struct { ID int64 `json:"id"` CharacterId int64 `json:"character_id"` Content string `json:"content"` DateCreated *utils.ISO8601Time `json:"date_created"` LastUpdated *utils.ISO8601Time `json:"last_updated"` }
PhraseResult is the type to be shown in the API for a Phrase
func NewPhraseResult ¶
func NewPhraseResult(ID int64, characterId int64, content string, dateCreacted *utils.ISO8601Time, lastUpdated *utils.ISO8601Time) PhraseResult
NewPhraseResult is a constructor for PhraseResult
func PhraseResultFromPhrase ¶
func PhraseResultFromPhrase(phrase Phrase) PhraseResult
PhraseResultFromPhrase creates a PhraseResult from a Phrase