repository

package
v0.0.0-...-d8258db Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2020 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 Comment

type Comment struct {
	UserID         uuid.UUID `db:"userId" json:"userId"`
	PresentationID int       `db:"presentationId" json:"presentationId"`
	Text           string    `db:"text" json:"text"`
}

type CommentRepository

type CommentRepository interface {
	CreateComment(comment *Comment) error
	GetComments(id int) ([]*Comment, error)
}

type Count

type Count struct {
	Stamp int `db:"stamp" json:"stamp"`
	Count int `db:"COUNT(stamp)" json:"count"`
}

type CreatePresentation

type CreatePresentation struct {
	Name        string `db:"name"`
	Speakers    string `db:"speakers"`
	Description string `db:"description"`
}

type Presentation

type Presentation struct {
	ID          int          `db:"id" json:"id"`
	Name        utils.String `db:"name" json:"name"`
	Speakers    utils.String `db:"speakers" json:"speakers"`
	Description utils.String `db:"description" json:"description"`
	Prev        utils.Int    `db:"prev" json:"prev"`
	Next        utils.Int    `db:"next" json:"next"`
	CreatedAt   time.Time    `db:"createdAt" json:"createdAt"`
	UpdatedAt   time.Time    `db:"updatedAt" json:"updatedAt"`
}

type PresentationRepository

type PresentationRepository interface {
	CreatePresentation(presentation *CreatePresentation) error
	UpdatePresentation(presentation *Presentation) error
	GetPresentations() ([]*Presentation, error)
	GetFirstPresentation() (*Presentation, error)
	GetPresentation(id int) (*Presentation, error)
	DeletePresentation(id int) error
}

type Reaction

type Reaction struct {
	UserID         uuid.UUID `db:"userId"`
	PresentationID int       `db:"presentationId"`
	Stamp          int       `db:"stamp"`
}

type ReactionRepository

type ReactionRepository interface {
	CreateReaction(reaction *Reaction) error
	GetReactionStatistics(id int) (*ReactionStatistics, error)
}

type ReactionStatistics

type ReactionStatistics struct {
	PresentationID int     `json:"presentationID"`
	Counts         []Count `json:"counts"`
}

type Repository

func NewSqlxRepository

func NewSqlxRepository(db *sqlx.DB) (Repository, error)

NewSqlxRepository リポジトリ実装を初期化して生成します

type Review

type Review struct {
	UserId         uuid.UUID `db:"userId"`
	PresentationId int       `db:"presentationId"`
	Score
}

type ReviewRepository

type ReviewRepository interface {
	IsExistReview(userID uuid.UUID, presenID int) (bool, error)
	CreateReview(review *Review) error
	UpdateReview(review *Review) error
	GetReviewStatistics(id int) (*ReviewStatistics, error)
}

type ReviewStatistics

type ReviewStatistics struct {
	PresentationId  int     `db:"presentationId" json:"presentationId"`
	Count           int     `db:"COUNT(*)" json:"count"`
	AvgSkill        float64 `db:"AVG(skill)" json:"avgSkill"`
	AvgArtistry     float64 `db:"AVG(artistry)" json:"avgArtistry"`
	AvgIdea         float64 `db:"AVG(idea)" json:"avgIdea"`
	AvgPresentation float64 `db:"AVG(presentation)" json:"avgPresentation"`
}

type Score

type Score struct {
	Skill        int `db:"skill"`
	Artistry     int `db:"artistry"`
	Idea         int `db:"idea"`
	Presentation int `db:"presentation"`
}

type SqlxRepository

type SqlxRepository struct {
	// contains filtered or unexported fields
}

SqlxRepository sqlxリポジトリ実装

func (*SqlxRepository) CreateComment

func (repo *SqlxRepository) CreateComment(comment *Comment) error

func (*SqlxRepository) CreatePresentation

func (repo *SqlxRepository) CreatePresentation(presentation *CreatePresentation) error

TODO: read lock

func (*SqlxRepository) CreateReaction

func (repo *SqlxRepository) CreateReaction(reaction *Reaction) error

func (*SqlxRepository) CreateReview

func (repo *SqlxRepository) CreateReview(review *Review) error

func (*SqlxRepository) DeletePresentation

func (repo *SqlxRepository) DeletePresentation(id int) error

func (*SqlxRepository) GetComments

func (repo *SqlxRepository) GetComments(id int) ([]*Comment, error)

func (*SqlxRepository) GetFirstPresentation

func (repo *SqlxRepository) GetFirstPresentation() (*Presentation, error)

func (*SqlxRepository) GetPresentation

func (repo *SqlxRepository) GetPresentation(id int) (*Presentation, error)

func (*SqlxRepository) GetPresentations

func (repo *SqlxRepository) GetPresentations() ([]*Presentation, error)

func (*SqlxRepository) GetReactionStatistics

func (repo *SqlxRepository) GetReactionStatistics(id int) (*ReactionStatistics, error)

func (*SqlxRepository) GetReviewStatistics

func (repo *SqlxRepository) GetReviewStatistics(id int) (*ReviewStatistics, error)

func (*SqlxRepository) GetState

func (repo *SqlxRepository) GetState() (*State, error)

func (*SqlxRepository) IsExistReview

func (repo *SqlxRepository) IsExistReview(userID uuid.UUID, presenID int) (bool, error)

func (*SqlxRepository) UpdatePresentation

func (repo *SqlxRepository) UpdatePresentation(presentation *Presentation) error

func (*SqlxRepository) UpdateReview

func (repo *SqlxRepository) UpdateReview(review *Review) error

func (*SqlxRepository) UpdateState

func (repo *SqlxRepository) UpdateState(state *State) error

type State

type State struct {
	Status string `db:"status" json:"status"`
	Info   string `db:"info" json:"info"`
}

type StateRepository

type StateRepository interface {
	UpdateState(*State) error
	GetState() (*State, error)
}

Jump to

Keyboard shortcuts

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