models

package
v0.0.0-...-7d5f2e1 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Score

type Score struct {
	ID             uuid.UUID `json:"id" db:"id"`
	CreatedAt      time.Time `json:"created_at" db:"created_at"`
	UpdatedAt      time.Time `json:"updated_at" db:"updated_at"`
	User1Id        string    `json:"user1_id" db:"user1_id"`
	User2Id        string    `json:"user2_id" db:"user2_id"`
	User1Points    int       `json:"user1_points" db:"user1_points"`
	User2Points    int       `json:"user2_points" db:"user2_points"`
	User1Sets      int       `json:"user1_sets" db:"user1_sets"`
	User2Sets      int       `json:"user2_sets" db:"user2_sets"`
	GoalsInBalance int       `json:"goals_in_balance" db:"goals_in_balance"`
}

Score represents current status of foosball match between two users.

func (*Score) ChangeSet

func (s *Score) ChangeSet(winnerID string)

ChangeSet add 1 set to the winner and set points and balance to 0.

func (*Score) IsSetFinished

func (s *Score) IsSetFinished() (finishedSet bool)

IsSetFinished check if current set is finished.

func (*Score) ScorePoints

func (s *Score) ScorePoints(scorerID string, pointsToAdd int)

ScorePoints add points to submitted scorer.

func (Score) String

func (s Score) String() (scoreString string)

String returns string representation of Score.

func (*Score) Validate

func (s *Score) Validate(tx *pop.Connection) (validatorErrors *validate.Errors, validationError error)

Validate gets run every time you call a "pop.Validate*" (pop.ValidateAndSave, pop.ValidateAndCreate, pop.ValidateAndUpdate) method.

func (*Score) ValidateCreate

func (s *Score) ValidateCreate(tx *pop.Connection) (validatorErrors *validate.Errors, validationError error)

ValidateCreate gets run every time you call "pop.ValidateAndCreate" method.

func (*Score) ValidateUpdate

func (s *Score) ValidateUpdate(tx *pop.Connection) (validatorErrors *validate.Errors, validationError error)

ValidateUpdate gets run every time you call "pop.ValidateAndUpdate" method.

Jump to

Keyboard shortcuts

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