model

package
v0.0.0-...-3051362 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 19, 2020 License: MIT Imports: 2 Imported by: 0

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

func NewCharacter

func NewCharacter(id int64, name string, dateCreated time.Time, lastUpdated time.Time) Character

NewCharacter is a constructor for Character

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

func NewPhrase

func NewPhrase(ID int64, characterId int64, character *Character, content string, dateCreacted time.Time, lastUpdated time.Time) Phrase

NewPhrase is a constructor for Phrase

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL