Documentation ¶
Overview ¶
*
- Copyright (C) 2019 KhronoSync Digital Solutions LLC *
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- any later version. *
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details. *
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <https://www.gnu.org/licenses/>
Index ¶
- Constants
- func Init(db *pg.DB)
- type RatingModel
- func DeleteById(id uuid.UUID) (*RatingModel, error)
- func GetAll() ([]RatingModel, error)
- func GetByDistroId(distroId uuid.UUID, sortOrder string) ([]RatingModel, error)
- func GetById(id uuid.UUID) (*RatingModel, error)
- func MarkUseful(id uuid.UUID) (*RatingModel, error)
- func Save(model RatingModel) (*RatingModel, error)
- type RatingRepository
- func (rr *RatingRepository) Create(rm *RatingModel) (*RatingModel, error)
- func (rr *RatingRepository) DeleteById(id uuid.UUID) (*RatingModel, error)
- func (rr *RatingRepository) MarkUseful(id uuid.UUID) (*RatingModel, error)
- func (rr *RatingRepository) Read() ([]RatingModel, error)
- func (rr *RatingRepository) ReadByDistroId(distroId uuid.UUID, sortOrder string) ([]RatingModel, error)
- func (rr *RatingRepository) ReadById(id uuid.UUID) (*RatingModel, error)
- type RatingsInfoModel
Constants ¶
View Source
const SortMostRecent = "created DESC"
View Source
const SortMostUseful = "upvotes DESC"
Variables ¶
This section is empty.
Functions ¶
Types ¶
type RatingModel ¶
type RatingModel struct { Id uuid.UUID `sql:"id,type:uuid,pk"` DistroId uuid.UUID `sql:"distro_id,type:uuid,fk:distros(id)"` Username string `sql:"username,type:varchar(100)"` RateOverall float64 `sql:"rate_overall,default:0"` RateWorkstation float64 `sql:"rate_workstation,default:0"` RateServer float64 `sql:"rate_server,default:0"` RateIoT float64 `sql:"rate_iot,default:0"` Comment string `sql:"comment,type:varchar(10000)"` Upvotes int64 `sql:"upvotes,default:0"` Created time.Time `sql:"created,default:now()"` // contains filtered or unexported fields }
func DeleteById ¶
func DeleteById(id uuid.UUID) (*RatingModel, error)
func GetAll ¶
func GetAll() ([]RatingModel, error)
func GetByDistroId ¶
func GetByDistroId(distroId uuid.UUID, sortOrder string) ([]RatingModel, error)
func MarkUseful ¶
func MarkUseful(id uuid.UUID) (*RatingModel, error)
func Save ¶
func Save(model RatingModel) (*RatingModel, error)
type RatingRepository ¶
type RatingRepository struct {
// contains filtered or unexported fields
}
func (*RatingRepository) Create ¶
func (rr *RatingRepository) Create(rm *RatingModel) (*RatingModel, error)
func (*RatingRepository) DeleteById ¶
func (rr *RatingRepository) DeleteById(id uuid.UUID) (*RatingModel, error)
func (*RatingRepository) MarkUseful ¶
func (rr *RatingRepository) MarkUseful(id uuid.UUID) (*RatingModel, error)
func (*RatingRepository) Read ¶
func (rr *RatingRepository) Read() ([]RatingModel, error)
func (*RatingRepository) ReadByDistroId ¶
func (rr *RatingRepository) ReadByDistroId( distroId uuid.UUID, sortOrder string, ) ([]RatingModel, error)
func (*RatingRepository) ReadById ¶
func (rr *RatingRepository) ReadById(id uuid.UUID) (*RatingModel, error)
type RatingsInfoModel ¶
type RatingsInfoModel struct { Heading string Total int64 Total5Star int64 Total4Star int64 Total3Star int64 Total2Star int64 Total1Star int64 Avg float64 Percent5Star float64 Percent4Star float64 Percent3Star float64 Percent2Star float64 Percent1Star float64 }
func CalcRatingsInfo ¶
func CalcRatingsInfo(distroId uuid.UUID) ([]RatingsInfoModel, error)
Click to show internal directories.
Click to hide internal directories.