Documentation ¶
Index ¶
- Variables
- func InitTable(db *gorm.DB) error
- type GORMRetroRepository
- func (repo *GORMRetroRepository) CreatePostit(ctx context.Context, p Postit) (Postit, error)
- func (repo *GORMRetroRepository) CreateRetro(ctx context.Context, tid int64, uid int64, name string) (Retro, error)
- func (repo *GORMRetroRepository) DeletePostitByID(ctx context.Context, pid int64) error
- func (repo *GORMRetroRepository) DeleteRetroByID(ctx context.Context, rid int64) error
- func (repo *GORMRetroRepository) DeleteTemplateByID(ctx context.Context, tid int64) error
- func (repo *GORMRetroRepository) GetPostitByID(ctx context.Context, pid int64) (Postit, error)
- func (repo *GORMRetroRepository) GetRetroByID(ctx context.Context, rid int64) (Retro, error)
- func (repo *GORMRetroRepository) GetRetros(ctx context.Context) ([]Retro, error)
- func (repo *GORMRetroRepository) GetTemplateByID(ctx context.Context, tid int64) (Template, error)
- func (repo *GORMRetroRepository) GetTemplates(ctx context.Context) ([]Template, error)
- func (repo *GORMRetroRepository) GetTopVotePostits(ctx context.Context, rid int64, n int) ([]Postit, error)
- func (repo *GORMRetroRepository) InsertTemplate(ctx context.Context, t Template) (Template, error)
- func (repo *GORMRetroRepository) UpdatePostit(ctx context.Context, p Postit) (Postit, error)
- func (repo *GORMRetroRepository) UpdateTemplate(ctx context.Context, t Template) (Template, error)
- func (repo *GORMRetroRepository) VotePostitByID(ctx context.Context, pid int64) error
- type GORMUserRepository
- type Postit
- type Question
- type Retro
- type RetroRepository
- type Template
- type TemplateQuestion
- type User
- type UserRepository
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrDuplicatedUser = errors.New("username already exists") ErrUserNotFound = gorm.ErrRecordNotFound )
View Source
var ErrIDNotFound = gorm.ErrRecordNotFound
Functions ¶
Types ¶
type GORMRetroRepository ¶
type GORMRetroRepository struct {
// contains filtered or unexported fields
}
func (*GORMRetroRepository) CreatePostit ¶
func (*GORMRetroRepository) CreateRetro ¶
func (*GORMRetroRepository) DeletePostitByID ¶
func (repo *GORMRetroRepository) DeletePostitByID(ctx context.Context, pid int64) error
func (*GORMRetroRepository) DeleteRetroByID ¶
func (repo *GORMRetroRepository) DeleteRetroByID(ctx context.Context, rid int64) error
func (*GORMRetroRepository) DeleteTemplateByID ¶
func (repo *GORMRetroRepository) DeleteTemplateByID(ctx context.Context, tid int64) error
func (*GORMRetroRepository) GetPostitByID ¶
func (*GORMRetroRepository) GetRetroByID ¶
func (*GORMRetroRepository) GetRetros ¶
func (repo *GORMRetroRepository) GetRetros(ctx context.Context) ([]Retro, error)
func (*GORMRetroRepository) GetTemplateByID ¶
func (*GORMRetroRepository) GetTemplates ¶
func (repo *GORMRetroRepository) GetTemplates(ctx context.Context) ([]Template, error)
func (*GORMRetroRepository) GetTopVotePostits ¶
func (*GORMRetroRepository) InsertTemplate ¶
func (*GORMRetroRepository) UpdatePostit ¶
func (*GORMRetroRepository) UpdateTemplate ¶
func (*GORMRetroRepository) VotePostitByID ¶
func (repo *GORMRetroRepository) VotePostitByID(ctx context.Context, pid int64) error
type GORMUserRepository ¶
type GORMUserRepository struct {
// contains filtered or unexported fields
}
func (*GORMUserRepository) FindByUsername ¶
type Postit ¶
type Postit struct { CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` DeletedAt gorm.DeletedAt `json:"deleted_at" gorm:"index"` ID int64 `json:"id" gorm:"primarykey;autoIncrement"` // belongs to UserID int64 `json:"owner_id"` User User `json:"owner"` // belongs to QuestionID int64 `json:"question_id"` Votes int `json:"votes"` // Content Content string `json:"content"` IsVisible bool `json:"is_visible"` }
type Question ¶
type Question struct { CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` DeletedAt gorm.DeletedAt `json:"deleted_at" gorm:"index"` ID int64 `json:"id" gorm:"primarykey;autoIncrement"` Content string `json:"content"` // fk RetroID int64 `json:"retro_id"` // has many Postits []Postit `json:"postIts"` }
type Retro ¶
type Retro struct { CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` DeletedAt gorm.DeletedAt `json:"deleted_at" gorm:"index"` ID int64 `json:"id" gorm:"primarykey;autoIncrement"` Name string `gorm:"index" json:"name"` // belongs to UserID int64 `json:"owner_id"` User User `json:"owner"` // Questions are copied from the template // has many Questions []Question `json:"questions"` }
type RetroRepository ¶
type RetroRepository interface { InsertTemplate(ctx context.Context, t Template) (Template, error) UpdateTemplate(ctx context.Context, t Template) (Template, error) GetTemplates(ctx context.Context) ([]Template, error) GetTemplateByID(ctx context.Context, tid int64) (Template, error) DeleteTemplateByID(ctx context.Context, tid int64) error CreateRetro(ctx context.Context, tid int64, uid int64, name string) (Retro, error) GetRetros(ctx context.Context) ([]Retro, error) GetRetroByID(ctx context.Context, rid int64) (Retro, error) DeleteRetroByID(ctx context.Context, rid int64) error CreatePostit(ctx context.Context, p Postit) (Postit, error) GetPostitByID(ctx context.Context, pid int64) (Postit, error) DeletePostitByID(ctx context.Context, pid int64) error UpdatePostit(ctx context.Context, p Postit) (Postit, error) VotePostitByID(ctx context.Context, pid int64) error GetTopVotePostits(ctx context.Context, rid int64, n int) ([]Postit, error) }
func NewRetroRepository ¶
func NewRetroRepository(db *gorm.DB) RetroRepository
type Template ¶
type Template struct { CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` DeletedAt gorm.DeletedAt `json:"deleted_at" gorm:"index"` ID int64 `json:"id" gorm:"primarykey;autoIncrement"` Name string `gorm:"index" json:"name"` // belongs to UserID int64 `json:"owner_id"` User User `json:"owner"` // has many Questions []TemplateQuestion `json:"questions"` }
type TemplateQuestion ¶
type UserRepository ¶
type UserRepository interface { Insert(ctx context.Context, u User) (User, error) FindByUsername(ctx context.Context, username string) (User, error) FindByID(ctx context.Context, id int64) (User, error) }
func NewUserRepository ¶
func NewUserRepository(db *gorm.DB) UserRepository
Click to show internal directories.
Click to hide internal directories.