Documentation
¶
Index ¶
- Variables
- func NewCoursesDao() coursesDao
- type AllTokensDto
- type AuditDao
- type BookmarkDao
- type CalendarResult
- type CameraPresetDao
- type ChatDao
- type CoursesDao
- type DaoWrapper
- type EmailDao
- type FileDao
- type InfoPageDao
- type IngestServerDao
- type LectureHallsDao
- type NotificationsDao
- type ProgressDao
- type Semester
- type ServerNotificationDao
- type Stat
- type StatisticsDao
- type StreamWithCourseAndSubtitles
- type StreamsDao
- type SubtitlesDao
- type TokenDao
- type TranscodingFailureDao
- type UploadKeyDao
- type UsersDao
- type VideoSectionDao
- type VideoSeekDao
- type WorkerDao
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // DB reference to database DB *gorm.DB Migrator = newMigrator() )
View Source
var Cache ristretto.Cache
View Source
var Progress = NewProgressDao()
Functions ¶
func NewCoursesDao ¶
func NewCoursesDao() coursesDao
Types ¶
type AllTokensDto ¶
type AuditDao ¶
type AuditDao interface {
// Create a new audit for the database
Create(*model.Audit) error
// Find audits
Find(limit int, offset int, types ...model.AuditType) (audits []model.Audit, err error)
}
func NewAuditDao ¶
func NewAuditDao() AuditDao
type BookmarkDao ¶
type BookmarkDao interface {
Add(*model.Bookmark) error
GetByID(uint) (model.Bookmark, error)
GetByStreamID(uint, uint) ([]model.Bookmark, error)
Update(*model.Bookmark) error
Delete(uint) error
}
func NewBookmarkDao ¶
func NewBookmarkDao() BookmarkDao
type CalendarResult ¶
type CalendarResult struct {
StreamID uint
Created time.Time
Start time.Time
End time.Time
CourseName string
LectureHallName string
}
func (CalendarResult) IsoCreated ¶
func (r CalendarResult) IsoCreated() string
func (CalendarResult) IsoEnd ¶
func (r CalendarResult) IsoEnd() string
func (CalendarResult) IsoStart ¶
func (r CalendarResult) IsoStart() string
type CameraPresetDao ¶
type CameraPresetDao interface {
GetDefaultCameraPreset(lectureHallID uint) (res model.CameraPreset, err error)
}
func NewCameraPresetDao ¶
func NewCameraPresetDao() CameraPresetDao
type ChatDao ¶
type ChatDao interface {
AddChatPollOptionVote(pollOptionId uint, userId uint) error
AddChatPoll(poll *model.Poll) error
AddMessage(chat *model.Chat) error
GetChatUsers(streamid uint) ([]model.User, error)
GetReactions(chatID uint) ([]model.ChatReaction, error)
GetVisibleChats(userID uint, streamID uint) ([]model.Chat, error)
GetAllChats(userID uint, streamID uint) ([]model.Chat, error)
GetActivePoll(streamID uint) (model.Poll, error)
GetPollUserVote(pollId uint, userId uint) (uint, error)
GetPollOptionVoteCount(pollOptionId uint) (int64, error)
GetPolls(streamID uint) ([]model.Poll, error)
ApproveChat(id uint) error
RetractChat(id uint) error
DeleteChat(id uint) error
ResolveChat(id uint) error
ToggleReaction(userID uint, chatID uint, username string, emoji string) error
RemoveReactions(chatID uint) error
CloseActivePoll(streamID uint) error
GetChatsByUser(userID uint) ([]model.Chat, error)
GetChat(id uint, userID uint) (*model.Chat, error)
}
func NewChatDao ¶
func NewChatDao() ChatDao
type CoursesDao ¶
type CoursesDao interface {
CreateCourse(ctx context.Context, course *model.Course, keep bool) error
AddAdminToCourse(userID uint, courseID uint) error
GetCurrentOrNextLectureForCourse(ctx context.Context, courseID uint) (model.Stream, error)
GetAllCourses() ([]model.Course, error)
GetCourseForLecturerIdByYearAndTerm(c context.Context, year int, term string, userId uint) ([]model.Course, error)
GetAdministeredCoursesByUserId(ctx context.Context, userid uint, teachingTerm string, year int) (courses []model.Course, err error)
GetAllCoursesForSemester(year int, term string, ctx context.Context) (courses []model.Course)
GetPublicCourses(year int, term string) (courses []model.Course, err error)
GetPublicAndLoggedInCourses(year int, term string) (courses []model.Course, err error)
GetCourseByToken(token string) (course model.Course, err error)
GetCourseById(ctx context.Context, id uint) (course model.Course, err error)
GetInvitedUsersForCourse(course *model.Course) error
GetCourseBySlugYearAndTerm(ctx context.Context, slug string, term string, year int) (model.Course, error)
// GetAllCoursesWithTUMIDFromSemester returns all courses with a non-null tum_identifier from a given semester or later
GetAllCoursesWithTUMIDFromSemester(ctx context.Context, year int, term string) (courses []model.Course, err error)
GetAvailableSemesters(c context.Context) []Semester
GetCourseByShortLink(link string) (model.Course, error)
GetCourseAdmins(courseID uint) ([]model.User, error)
UpdateCourse(ctx context.Context, course model.Course) error
UpdateCourseMetadata(ctx context.Context, course model.Course)
UnDeleteCourse(ctx context.Context, course model.Course) error
RemoveAdminFromCourse(userID uint, courseID uint) error
DeleteCourse(course model.Course)
}
type DaoWrapper ¶
type DaoWrapper struct {
CameraPresetDao
ChatDao
FileDao
StreamsDao
CoursesDao
WorkerDao
LectureHallsDao
UsersDao
UploadKeyDao
StatisticsDao
ProgressDao
ServerNotificationDao
TokenDao
NotificationsDao
IngestServerDao
VideoSectionDao
VideoSeekDao
// AuditDao.Find(...) seems like a nice api, find can be used in other dao as well if type is not embedded
AuditDao AuditDao
InfoPageDao
BookmarkDao BookmarkDao
SubtitlesDao
TranscodingFailureDao
EmailDao
}
func NewDaoWrapper ¶
func NewDaoWrapper() DaoWrapper
type EmailDao ¶
type EmailDao interface {
// Get Email by ID
Get(context.Context, uint) (model.Email, error)
// Create an new Email for the database
Create(context.Context, *model.Email) error
// Delete an Email by id.
Delete(context.Context, uint) error
// Save an Email by id.
Save(context.Context, *model.Email) error
// GetDue Gets a number of emails that is due for sending.
GetDue(context.Context, int) ([]model.Email, error)
// GetFailed Gets all failed sending attempts.
GetFailed(context.Context) ([]model.Email, error)
}
func NewEmailDao ¶
func NewEmailDao() EmailDao
type FileDao ¶
type FileDao interface {
NewFile(f *model.File) error
GetFileById(id string) (f model.File, err error)
UpdateFile(id string, f *model.File) error
DeleteFile(id uint) error
CountVoDFiles() (int64, error)
SetThumbnail(streamId uint, thumb model.File) error
}
func NewFileDao ¶
func NewFileDao() FileDao
type InfoPageDao ¶
type InfoPageDao interface {
New(*model.InfoPage) error
GetAll() ([]model.InfoPage, error)
GetById(uint) (model.InfoPage, error)
Update(uint, *model.InfoPage) error
}
func NewInfoPageDao ¶
func NewInfoPageDao() InfoPageDao
type IngestServerDao ¶
type IngestServerDao interface {
SaveSlot(slot model.StreamName)
SaveIngestServer(server model.IngestServer)
GetBestIngestServer() (server model.IngestServer, err error)
GetTranscodedStreamSlot(ingestServerID uint) (sn model.StreamName, err error)
GetStreamSlot(ingestServerID uint) (sn model.StreamName, err error)
RemoveStreamFromSlot(streamID uint) error
}
func NewIngestServerDao ¶
func NewIngestServerDao() IngestServerDao
type LectureHallsDao ¶
type LectureHallsDao interface {
CreateLectureHall(lectureHall model.LectureHall)
SavePreset(preset model.CameraPreset) error
SaveLectureHallFullAssoc(lectureHall model.LectureHall)
SaveLectureHall(lectureHall model.LectureHall) error
FindPreset(lectureHallID string, presetID string) (model.CameraPreset, error)
GetAllLectureHalls() []model.LectureHall
GetLectureHallByPartialName(name string) (model.LectureHall, error)
GetLectureHallByID(id uint) (model.LectureHall, error)
GetStreamsForLectureHallIcal(userId uint, lectureHalls []uint, all bool) ([]CalendarResult, error)
UnsetDefaults(lectureHallID string) error
DeleteLectureHall(id uint) error
}
func NewLectureHallsDao ¶
func NewLectureHallsDao() LectureHallsDao
type NotificationsDao ¶
type NotificationsDao interface {
AddNotification(notification *model.Notification) error
GetNotifications(target ...model.NotificationTarget) ([]model.Notification, error)
GetAllNotifications() ([]model.Notification, error)
DeleteNotification(id uint) error
}
func NewNotificiationsDao ¶
func NewNotificiationsDao() NotificationsDao
type ProgressDao ¶
type ProgressDao interface {
SaveProgresses(progresses []model.StreamProgress) error
GetProgressesForUser(userID uint) ([]model.StreamProgress, error)
LoadProgress(userID uint, streamIDs []uint) (streamProgress []model.StreamProgress, err error)
SaveWatchedState(progress *model.StreamProgress) error
}
func NewProgressDao ¶
func NewProgressDao() ProgressDao
type ServerNotificationDao ¶
type ServerNotificationDao interface {
CreateServerNotification(notification model.ServerNotification) error
GetCurrentServerNotifications() ([]model.ServerNotification, error)
GetAllServerNotifications() ([]model.ServerNotification, error)
UpdateServerNotification(notification model.ServerNotification, id string) error
DeleteServerNotification(notificationId string) error
}
func NewServerNotificationDao ¶
func NewServerNotificationDao() ServerNotificationDao
type Stat ¶
Stat key value struct that is parsable by Chart.js without further modifications. See https://www.chartjs.org/docs/master/general/data-structures.html
type StatisticsDao ¶
type StatisticsDao interface {
AddStat(stat model.Stat) error
GetCourseNumStudents(courseID uint) (int64, error)
GetCourseNumVodViews(courseID uint) (int, error)
GetCourseNumLiveViews(courseID uint) (int, error)
GetLectureNumVodViews(streamID uint) (int, error)
GetLectureNumLiveViews(streamID uint) (int, error)
GetCourseNumVodViewsPerDay(courseID uint) ([]Stat, error)
GetLectureNumVodViewsPerDay(streamID uint) ([]Stat, error)
GetCourseStatsWeekdays(courseID uint) ([]Stat, error)
GetCourseStatsHourly(courseID uint) ([]Stat, error)
GetLectureStatsWeekdays(courseID uint, streamID uint) ([]Stat, error)
GetLectureStatsHourly(courseID uint, streamID uint) ([]Stat, error)
GetLectureStats(courseID uint, lectureID uint) ([]Stat, error)
GetStudentActivityCourseStats(courseID uint, live bool) ([]Stat, error)
GetStreamNumLiveViews(streamID uint) (int, error)
}
func NewStatisticsDao ¶
func NewStatisticsDao() StatisticsDao
type StreamsDao ¶
type StreamsDao interface {
CreateStream(stream *model.Stream) error
AddVodView(id string) error
GetDueStreamsForWorkers() []model.Stream
GetDuePremieresForWorkers() []model.Stream
GetStreamByKey(ctx context.Context, key string) (stream model.Stream, err error)
GetUnitByID(id string) (model.StreamUnit, error)
GetStreamByTumOnlineID(ctx context.Context, id uint) (stream model.Stream, err error)
GetStreamsByIds(ids []uint) ([]model.Stream, error)
GetStreamByID(ctx context.Context, id string) (stream model.Stream, err error)
GetWorkersForStream(stream model.Stream) ([]model.Worker, error)
GetAllStreams() ([]model.Stream, error)
ExecAllStreamsWithCoursesAndSubtitles(f func([]StreamWithCourseAndSubtitles))
GetCurrentLive(ctx context.Context) (currentLive []model.Stream, err error)
GetCurrentLiveNonHidden(ctx context.Context) (currentLive []model.Stream, err error)
GetLiveStreamsInLectureHall(lectureHallId uint) ([]model.Stream, error)
GetStreamsWithWatchState(courseID uint, userID uint) (streams []model.Stream, err error)
SetLectureHall(streamIDs []uint, lectureHallID uint) error
UnsetLectureHall(streamIDs []uint) error
UpdateStream(stream model.Stream) error
SaveWorkerForStream(stream model.Stream, worker model.Worker) error
ClearWorkersForStream(stream model.Stream) error
UpdateSilences(silences []model.Silence, streamID string) error
DeleteSilences(streamID string) error
UpdateStreamFullAssoc(vod *model.Stream) error
SetStreamNotLiveById(streamID uint) error
SetStreamLiveNowTimestampById(streamID uint, liveNowTimestamp time.Time) error
SaveEndedState(streamID uint, hasEnded bool) error
SaveCOMBURL(stream *model.Stream, url string)
SaveCAMURL(stream *model.Stream, url string)
SavePRESURL(stream *model.Stream, url string)
SaveTranscodingProgress(progress model.TranscodingProgress) error
RemoveTranscodingProgress(streamVersion model.StreamVersion, streamId uint) error
GetTranscodingProgressByVersion(streamVersion model.StreamVersion, streamId uint) (model.TranscodingProgress, error)
SaveStream(vod *model.Stream) error
ToggleVisibility(streamId uint, private bool) error
DeleteStream(streamID string)
DeleteUnit(id uint)
DeleteStreamsWithTumID(ids []uint)
UpdateLectureSeries(model.Stream) error
DeleteLectureSeries(string) error
}
func NewStreamsDao ¶
func NewStreamsDao() StreamsDao
type SubtitlesDao ¶
type SubtitlesDao interface {
// Get Subtitles by ID
Get(context.Context, uint) (model.Subtitles, error)
// GetByStreamIDandLang returns the subtitles for a given query
GetByStreamIDandLang(context.Context, uint, string) (model.Subtitles, error)
// CreateOrUpsert creates or updates subtitles for the database
CreateOrUpsert(context.Context, *model.Subtitles) error
// Create saves subtitles
Create(c context.Context, it *model.Subtitles) error
// Delete a Subtitles by id.
Delete(context.Context, uint) error
}
func NewSubtitlesDao ¶
func NewSubtitlesDao() SubtitlesDao
type TokenDao ¶
type TokenDao interface {
AddToken(token model.Token) error
GetToken(token string) (model.Token, error)
GetAllTokens() ([]AllTokensDto, error)
TokenUsed(token model.Token) error
DeleteToken(id string) error
}
func NewTokenDao ¶
func NewTokenDao() TokenDao
type TranscodingFailureDao ¶
type TranscodingFailureDao interface {
// All returns all open transcoding failures
All() ([]model.TranscodingFailure, error)
// New creates a new transcoding failure
New(*model.TranscodingFailure) error
// Delete deletes a transcoding failure
Delete(id uint) error
}
func NewTranscodingFailureDao ¶
func NewTranscodingFailureDao() TranscodingFailureDao
type UploadKeyDao ¶
type UploadKeyDao interface {
GetUploadKey(key string) (model.UploadKey, error)
CreateUploadKey(key string, stream uint, videoType model.VideoType) error
DeleteUploadKey(key model.UploadKey) error
}
func NewUploadKeyDao ¶
func NewUploadKeyDao() UploadKeyDao
type UsersDao ¶
type UsersDao interface {
AreUsersEmpty(ctx context.Context) (isEmpty bool, err error)
CreateUser(ctx context.Context, user *model.User) (err error)
DeleteUser(ctx context.Context, uid uint) (err error)
SearchUser(query string) (users []model.User, err error)
IsUserAdmin(ctx context.Context, uid uint) (res bool, err error)
GetUserByEmail(ctx context.Context, email string) (user model.User, err error)
GetAllAdminsAndLecturers(users *[]model.User) (err error)
GetUserByID(ctx context.Context, id uint) (user model.User, err error)
CreateRegisterLink(ctx context.Context, user model.User) (registerLink model.RegisterLink, err error)
GetUserByResetKey(key string) (model.User, error)
DeleteResetKey(key string)
UpdateUser(user model.User) error
HasPinnedCourse(model.User, uint) (bool, error)
PinCourse(user model.User, course model.Course, pin bool) error
UpsertUser(user *model.User) error
AddUsersToCourseByTUMIDs(matrNr []string, courseID uint) error
AddUserSetting(userSetting *model.UserSetting) error
}
func NewUsersDao ¶
func NewUsersDao() UsersDao
type VideoSectionDao ¶
type VideoSectionDao interface {
Create([]model.VideoSection) error
Update(*model.VideoSection) error
Delete(uint) error
Get(uint) (model.VideoSection, error)
GetByStreamId(uint) ([]model.VideoSection, error)
}
func NewVideoSectionDao ¶
func NewVideoSectionDao() VideoSectionDao
type VideoSeekDao ¶
type VideoSeekDao interface {
Add(streamID string, pos float64) error
Get(streamID string) ([]model.VideoSeekChunk, error)
}
func NewVideoSeekDao ¶
func NewVideoSeekDao() VideoSeekDao
type WorkerDao ¶
type WorkerDao interface {
CreateWorker(worker *model.Worker) error
SaveWorker(worker model.Worker) error
GetAllWorkers() ([]model.Worker, error)
GetAliveWorkers() []model.Worker
GetWorkerByHostname(ctx context.Context, hostname string) (model.Worker, error)
GetWorkerByID(ctx context.Context, workerID string) (model.Worker, error)
DeleteWorker(workerID string) error
}
func NewWorkerDao ¶
func NewWorkerDao() WorkerDao
Source Files
¶
- audit.go
- bookmark.go
- cache.go
- camera-preset.go
- chat.go
- courses.go
- dao_base.go
- dao_logger.go
- email.go
- file.go
- info-page.go
- ingest_server.go
- lecture_halls.go
- migrator.go
- notifications.go
- progress.go
- server-notification.go
- statistics.go
- streams.go
- subtitles.go
- token.go
- transcoding-failure.go
- upload_key.go
- users.go
- video-section.go
- video-seek.go
- worker.go
Click to show internal directories.
Click to hide internal directories.