Documentation
¶
Index ¶
- Constants
- Variables
- func InvalidateUserCache(id uint)
- type AllTokensDto
- type AuditDao
- type BookmarkDao
- type CalendarResult
- type ChatDao
- type Course
- type CoursesDao
- type CoursesDaoImpl
- func (d CoursesDaoImpl) AddAdminToCourse(userID uint, courseID uint) error
- func (d CoursesDaoImpl) AddUserToCourse(ctx context.Context, userID uint, courseID uint) error
- func (d CoursesDaoImpl) CreateCourse(ctx context.Context, course *model.Course, keep bool) error
- func (d CoursesDaoImpl) DeleteCourse(course model.Course)
- func (d CoursesDaoImpl) ExecAllCourses(f func([]Course))
- func (d CoursesDaoImpl) GetAdministeredCoursesByUserId(ctx context.Context, userid uint, teachingTerm string, year int) (courses []model.Course, err error)
- func (d CoursesDaoImpl) GetAllCourses() ([]model.Course, error)
- func (d CoursesDaoImpl) GetAllCoursesForSemester(ctx context.Context, year int, term string) (courses []model.Course)
- func (d CoursesDaoImpl) GetAllCoursesWithTUMIDFromSemester(ctx context.Context, year int, term string) (courses []model.Course, err error)
- func (d CoursesDaoImpl) GetAvailableSemesters(c context.Context, includeTestSemester bool) []model.Semester
- func (d CoursesDaoImpl) GetCourseAdmins(courseID uint) ([]model.User, error)
- func (d CoursesDaoImpl) GetCourseById(ctx context.Context, id uint) (course model.Course, err error)
- func (d CoursesDaoImpl) GetCourseBySlugYearAndTerm(ctx context.Context, slug string, term string, year int) (model.Course, error)
- func (d CoursesDaoImpl) GetCourseByToken(token string) (model.Course, error)
- func (d CoursesDaoImpl) GetInvitedUsersForCourse(course *model.Course) error
- func (d CoursesDaoImpl) GetPublicAndLoggedInCourses(year int, term string) (courses []model.Course, err error)
- func (d CoursesDaoImpl) GetPublicCourses(year int, term string) (courses []model.Course, err error)
- func (d CoursesDaoImpl) RemoveAdminFromCourse(userID uint, courseID uint) error
- func (d CoursesDaoImpl) UnDeleteCourse(ctx context.Context, course model.Course) error
- func (d CoursesDaoImpl) UpdateCourse(ctx context.Context, course model.Course) error
- func (d CoursesDaoImpl) UpdateCourseColumns(ctx context.Context, course model.Course, columns ...string) error
- type DaoWrapper
- type EmailDao
- type FileDao
- type InfoPageDao
- type IngestServerDao
- type IntegrationDao
- type IntegrationGrantDao
- type LectureCutDao
- type LectureHallsDao
- type LectureSeriesUpdate
- type MediaReapDao
- type NotificationsDao
- type ProgressDao
- type PwrCtrlLiveState
- type ReapFile
- type ReapStream
- type RunnerDao
- type ScheduleEntry
- type ServerNotificationDao
- type Stat
- type StatisticsDao
- type StreamReactionDao
- type StreamWithCourseAndSubtitles
- type StreamsDao
- type SubtitlesDao
- type TokenDao
- type TranscodingFailureDao
- type UsersDao
- type VideoSectionDao
- type VideoSeekDao
Constants ¶
const SeekHeatmapChunks = maxChunksPerVideo
SeekHeatmapChunks is into how many equal slices a recording's seeks are counted; chunk indexes run from 0 to SeekHeatmapChunks - 1.
Variables ¶
var ( // DB reference to database DB *gorm.DB Migrator = newMigrator() )
var Cache *ristretto.Cache[string, any]
var ErrIntegrationUploadRefused = errors.New("the upload reference cannot take another upload")
ErrIntegrationUploadRefused is a reference whose lecture took its upload, was closed or deleted, or belongs to another grant: a new upload needs a new reference.
var ErrPositionOutOfRange = errors.New("position is bigger than stream duration")
ErrPositionOutOfRange is returned when a reported seek position exceeds the stream duration.
var Progress = NewProgressDao()
Functions ¶
func InvalidateUserCache ¶ added in v1.7.10
func InvalidateUserCache(id uint)
InvalidateUserCache drops the cached copy of a user and its settings. Anything writing to a user must call it: the entry lives ten seconds, long enough for a client to read back the value from before its own write.
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)
// Count the audits of the given types, so a client can page without probing.
Count(types ...model.AuditType) (int64, error)
// FindByCourse is Find for the entries about one course, its lectures included.
FindByCourse(courseID uint, limit int, offset int, types ...model.AuditType) (audits []model.Audit, err error)
CountByCourse(courseID uint, types ...model.AuditType) (int64, 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 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
GetAllCourses() ([]model.Course, error)
GetAdministeredCoursesByUserId(ctx context.Context, userid uint, teachingTerm string, year int) (courses []model.Course, err error)
GetAllCoursesForSemester(ctx context.Context, year int, term string) (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, includeTestSemester bool) []model.Semester
GetCourseAdmins(courseID uint) ([]model.User, error)
// ExecAllCourses executes f on all courses from database without batching
ExecAllCourses(f func([]Course))
UpdateCourse(ctx context.Context, course model.Course) error
// UpdateCourseColumns writes the named columns of course, zero values included,
// and nothing else. UpdateCourse skips zero values, so it cannot switch a setting
// off, and saving the whole course writes every association it was loaded with.
UpdateCourseColumns(ctx context.Context, course model.Course, columns ...string) error
// AddUserToCourse enrols a user in a course; enrolling them twice is no error.
AddUserToCourse(ctx context.Context, userID uint, courseID uint) error
UnDeleteCourse(ctx context.Context, course model.Course) error
RemoveAdminFromCourse(userID uint, courseID uint) error
DeleteCourse(course model.Course)
}
type CoursesDaoImpl ¶
type CoursesDaoImpl struct {
// contains filtered or unexported fields
}
func NewCoursesDao ¶
func NewCoursesDao() CoursesDaoImpl
func (CoursesDaoImpl) AddAdminToCourse ¶
func (d CoursesDaoImpl) AddAdminToCourse(userID uint, courseID uint) error
func (CoursesDaoImpl) AddUserToCourse ¶ added in v1.9.0
func (CoursesDaoImpl) CreateCourse ¶
CreateCourse creates a new course, if keep is false, deleted_at is set to NOW(), letting the user manually create the course again (opt-in)
func (CoursesDaoImpl) DeleteCourse ¶
func (d CoursesDaoImpl) DeleteCourse(course model.Course)
func (CoursesDaoImpl) ExecAllCourses ¶
func (d CoursesDaoImpl) ExecAllCourses(f func([]Course))
ExecAllCourses executes f on all courses.
loads every course into memory
func (CoursesDaoImpl) GetAdministeredCoursesByUserId ¶
func (CoursesDaoImpl) GetAllCourses ¶
func (d CoursesDaoImpl) GetAllCourses() ([]model.Course, error)
GetAllCourses retrieves all courses from the database.
func (CoursesDaoImpl) GetAllCoursesForSemester ¶
func (CoursesDaoImpl) GetAllCoursesWithTUMIDFromSemester ¶
func (CoursesDaoImpl) GetAvailableSemesters ¶
func (CoursesDaoImpl) GetCourseAdmins ¶
func (d CoursesDaoImpl) GetCourseAdmins(courseID uint) ([]model.User, error)
GetCourseAdmins returns the admins of the given course excluding the creator (usually system) and the tumlive admins
func (CoursesDaoImpl) GetCourseById ¶
func (CoursesDaoImpl) GetCourseBySlugYearAndTerm ¶
func (CoursesDaoImpl) GetCourseByToken ¶
func (d CoursesDaoImpl) GetCourseByToken(token string) (model.Course, error)
func (CoursesDaoImpl) GetInvitedUsersForCourse ¶
func (d CoursesDaoImpl) GetInvitedUsersForCourse(course *model.Course) error
func (CoursesDaoImpl) GetPublicAndLoggedInCourses ¶
func (CoursesDaoImpl) GetPublicCourses ¶
func (CoursesDaoImpl) RemoveAdminFromCourse ¶
func (d CoursesDaoImpl) RemoveAdminFromCourse(userID uint, courseID uint) error
func (CoursesDaoImpl) UnDeleteCourse ¶
UnDeleteCourse restores the course and the streams DeleteCourse deleted with it. Streams removed on their own earlier stay removed: the admin chose that separately. Restoring only the course row would leave a live course with no lectures, and their media would still be reaped as belonging to deleted streams.
func (CoursesDaoImpl) UpdateCourse ¶
func (CoursesDaoImpl) UpdateCourseColumns ¶ added in v1.9.0
type DaoWrapper ¶
type DaoWrapper struct {
ChatDao
FileDao
StreamsDao
CoursesDao
LectureHallsDao
UsersDao
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
StreamReactionDao
RunnerDao RunnerDao
IntegrationDao
IntegrationGrantDao
MediaReapDao MediaReapDao
LectureCutDao
}
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)
DeleteFile(id uint) error
CountVoDFiles() (int64, error)
SetThumbnail(streamId uint, thumb model.File) error
GetThumbnail(streamId uint, fileType model.FileType) (f model.File, err error)
// SetStreamFile makes file the only file of its type the stream has.
SetStreamFile(streamId uint, file model.File) error
// GetStreamFile is the stream's file of the type, gorm.ErrRecordNotFound if it has none.
GetStreamFile(streamId uint, fileType model.FileType) (f model.File, err error)
// DeleteStreamFiles removes the rows of the stream's files of the type, not the files.
DeleteStreamFiles(streamId uint, fileType model.FileType) error
}
func NewFileDao ¶
func NewFileDao() FileDao
type InfoPageDao ¶
type InfoPageDao interface {
New(*model.InfoPage) error
GetAll() ([]model.InfoPage, error)
GetById(uint) (model.InfoPage, error)
// GetBySlug uses First, so a missing slug comes back as gorm.ErrRecordNotFound
// rather than a zero-valued page: callers need to tell "no such page" from "found".
GetBySlug(string) (model.InfoPage, error)
Update(uint, *model.InfoPage) error
Delete(uint) error
}
func NewInfoPageDao ¶
func NewInfoPageDao() InfoPageDao
type IngestServerDao ¶
type IngestServerDao interface {
SaveSlot(slot model.StreamName)
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 IntegrationDao ¶ added in v1.8.1
type IntegrationDao interface {
CreateIntegration(*model.Integration) error
GetIntegrationByAPIKeyHash(context.Context, []byte) (model.Integration, error)
GetIntegrations() ([]model.Integration, error)
SetIntegrationAPIKey(uint, []byte) error
}
func NewIntegrationDao ¶ added in v1.8.1
func NewIntegrationDao() IntegrationDao
type IntegrationGrantDao ¶ added in v1.9.0
type IntegrationGrantDao interface {
GetIntegrationByID(context.Context, uint) (model.Integration, error)
GetAuthorizableCourses(context.Context, uint) ([]model.Course, error)
GetCourseForAuthorization(context.Context, uint) (model.Course, error)
ApproveIntegrationCourse(context.Context, uint, uint, []byte, []byte, time.Time) (uint, error)
RedeemIntegrationAuthorizationCode(context.Context, uint, []byte, []byte, time.Time) (uint, uint, error)
GetIntegrationGrantCourse(context.Context, uint, uint) (model.Course, error)
GetIntegrationGrantStream(context.Context, uint, uint, uint) (model.Stream, error)
CreateIntegrationUpload(context.Context, uint, uint, string, model.Stream, []byte, time.Time) (model.Stream, bool, error)
GetIntegrationUploadReturnURL(context.Context, []byte, time.Time) (string, error)
ConsumeIntegrationUploadTicket(context.Context, []byte, time.Time) (model.Stream, error)
GetCourseIntegrationGrants(context.Context, uint) ([]model.IntegrationGrant, error)
RevokeIntegrationGrant(context.Context, uint, uint) error
RevokeIntegrationGrantForIntegration(context.Context, uint, uint) (model.Course, error)
}
func NewIntegrationGrantDao ¶ added in v1.9.0
func NewIntegrationGrantDao() IntegrationGrantDao
type LectureCutDao ¶ added in v1.16.0
type LectureCutDao interface {
// ClaimLectureCut records a cut that is starting, unless the source lecture has one that is
// not finished. claimed says which. Atomic: of two calls for the same lecture only one
// claims it.
ClaimLectureCut(cut model.LectureCut) (claimed bool, err error)
// GetLectureCut is the cut under way that makes the VODs of the lecture.
GetLectureCut(targetStreamID uint) (model.LectureCut, error)
// GetLectureCutBySource is the cut under way of a lecture, gorm.ErrRecordNotFound if none.
GetLectureCutBySource(sourceStreamID uint) (model.LectureCut, error)
// DeleteLectureCut drops a cut that was not carried out.
DeleteLectureCut(targetStreamID uint) error
// FinishLectureCut moves what the lecture has that refers to times in the recording onto
// the cut one, and ends the cut. All of it or none, so that a second try after a failure
// cannot move it twice. The cut is matched by its token, so that a call that read it
// before another finished it cannot finish the next cut of the lecture. Two versions finishing at once both get here: only the one that
// takes the cut's row does the work, and finished says whether that was this call.
//
// The offsets and video sections are moved, the silences, which are measured on the
// recording, are removed for a scan of the new one. A duplicate takes over the
// visibility the source had and the source becomes private.
FinishLectureCut(cut model.LectureCut) (finished bool, err error)
}
func NewLectureCutDao ¶ added in v1.16.0
func NewLectureCutDao() LectureCutDao
type LectureHallsDao ¶
type LectureHallsDao interface {
CreateLectureHall(lectureHall *model.LectureHall) error
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)
// GetSchedule returns the lectures overlapping [from, to) of the courses userID
// owns or administers -- every course for userID 0 -- in the given lecture halls,
// where hall 0 stands for lectures with none, or in every hall when all is set.
GetSchedule(userID uint, from, to time.Time, lectureHalls []uint, all bool) ([]ScheduleEntry, error)
UnsetDefaults(lectureHallID string) error
DeleteLectureHall(id uint) error
GetLiveStateForPwrCtrl() ([]PwrCtrlLiveState, error)
}
func NewLectureHallsDao ¶
func NewLectureHallsDao() LectureHallsDao
type LectureSeriesUpdate ¶ added in v1.9.0
type LectureSeriesUpdate struct {
Name *string
Description *string
ChatEnabled *bool
// 0 moves the series out of any hall.
LectureHallID *uint
}
LectureSeriesUpdate is what UpdateCourseLectureSeries sets; nil fields are left.
type MediaReapDao ¶ added in v1.14.0
type MediaReapDao interface {
// ReapStreams returns every stream, soft-deleted or not.
ReapStreams() ([]ReapStream, error)
// ReapFiles returns every File row except the deprecated VOD type, whose paths are
// legacy locations the reaper does not handle.
ReapFiles() ([]ReapFile, error)
}
MediaReapDao reads what the media reaper needs: every stream and File row, soft-deleted ones included. Both reads select only the columns used, because the reaper holds the whole set in memory to tell which files a live stream still references.
func NewMediaReapDao ¶ added in v1.14.0
func NewMediaReapDao() MediaReapDao
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 {
SaveProgress(progress model.StreamProgress, watched *bool) error
GetProgressesForUser(userID uint) ([]model.StreamProgress, error)
LoadProgress(userID uint, streamIDs []uint) (streamProgress []model.StreamProgress, err error)
}
func NewProgressDao ¶
func NewProgressDao() ProgressDao
type PwrCtrlLiveState ¶ added in v1.7.5
type ReapStream ¶ added in v1.14.0
type ReapStream struct {
ID uint
CourseID uint
DeletedAt gorm.DeletedAt
PlaylistUrl, PlaylistUrlPRES, PlaylistUrlCAM string
}
func (ReapStream) Deleted ¶ added in v1.14.0
func (r ReapStream) Deleted() *time.Time
type RunnerDao ¶
type RunnerDao interface {
// Get Runner by ID
Get(context.Context, string) (model.Runner, error)
// Create a new Runner for the database
Create(context.Context, *model.Runner) error
// Delete a Runner by hostname.
Delete(context.Context, string) error
// Update a Runner by hostname.
Update(context.Context, *model.Runner) error
// GetAll gets a list of all Runners.
GetAll(context.Context) ([]model.Runner, error)
// ReserveRunner returns the runner that currently runs the least jobs and is not draining.
// It also increments the number of jobs assigned to the runner.
ReserveRunner(context.Context) (model.Runner, error)
}
func NewRunnerDao ¶
func NewRunnerDao() RunnerDao
type ScheduleEntry ¶ added in v1.9.0
type ScheduleEntry struct {
StreamID uint
CourseID uint
CourseName string
Name string
Description string
Start time.Time
End time.Time
LectureHallID uint
LectureHallName string
}
ScheduleEntry is one lecture on the administration schedule.
type ServerNotificationDao ¶
type ServerNotificationDao interface {
// CreateServerNotification creates notification and sets its ID field to the row
// the database assigned, the way InfoPageDao.New does -- the admin API hands the
// created row straight back to the caller and would otherwise have to re-query.
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)
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 StreamReactionDao ¶ added in v1.7.12
type StreamReactionDao interface {
// Get StreamReaction by ID
Get(context.Context, uint) (model.StreamReaction, error)
// Create a new StreamReaction for the database
Create(context.Context, *model.StreamReaction) error
// Update an existing StreamReaction.
Update(context.Context, *model.StreamReaction) error
// Delete a StreamReaction by id.
Delete(context.Context, uint) error
GetByStreamWithinMinutes(context.Context, uint, uint) ([]model.StreamReaction, error)
// GetByStreamAndUser gets the StreamReaction a user has for a stream, if any
GetByStreamAndUser(context.Context, uint, uint) (model.StreamReaction, error)
}
func NewStreamReactionDao ¶ added in v1.7.12
func NewStreamReactionDao() StreamReactionDao
type StreamsDao ¶
type StreamsDao interface {
CreateStream(stream *model.Stream) error
CreateStreams(streams []model.Stream) error
AddVodView(id string) error
GetDueStreamsForRunners() ([]model.Stream, error)
GetStreamByKey(ctx context.Context, key string) (stream model.Stream, err error)
GetStreamByTumOnlineID(ctx context.Context, id uint) (stream model.Stream, err error)
GetStreamByID(ctx context.Context, id string) (stream model.Stream, err error)
GetAllStreams() ([]model.Stream, error)
GetRecordedStreamsForExport(ctx context.Context, courseID uint) ([]model.Stream, error)
ExecAllStreamsWithCoursesAndSubtitlesBatched(f func([]StreamWithCourseAndSubtitles))
GetCurrentLive(ctx context.Context) (currentLive []model.Stream, err error)
GetLiveStreamsInLectureHall(lectureHallId uint) ([]model.Stream, error)
GetSoonStartingStreamInfo(user *model.User, slug string, year int, term string) (string, string, error)
CreateOrGetTestCourse(user *model.User) (model.Course, error)
SetLectureHall(streamIDs []uint, lectureHallID uint) error
UnsetLectureHall(streamIDs []uint) error
UpdateStream(stream model.Stream) error
SaveRunnerJobForStream(streamID uint, version model.StreamVersion, runnerHostname, jobID string) error
GetRunnerJobsForStream(streamID uint) ([]model.StreamRunnerJob, error)
ClearRunnerJobsForStream(streamID uint) error
ClearRunnerJobForStream(streamID uint, version model.StreamVersion) error
HasRunnerJobForStreamVersion(streamID uint, version model.StreamVersion) (bool, error)
CountRunnerJobsForStream(streamID uint) (int64, error)
ClearRunnerJobsByHostname(hostname string) error
GetStaleStreams(ctx context.Context) ([]model.Stream, error)
UpdateSilences(silences []model.Silence, streamID string) error
DeleteSilences(streamID string) 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
// UpdateTranscodingProgress moves the percentage of a conversion that is under way.
// It does nothing for a version with no row, or one that failed: a report that comes
// late must not revive what a notification that came after it has ended.
UpdateTranscodingProgress(streamVersion model.StreamVersion, streamId uint, progress int) 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
// SetDuration stores the length of the stream's VOD in seconds. It writes that one
// column, so it cannot undo what another update of the stream has just saved.
SetDuration(streamID uint, seconds uint32) error
// SetThumbInterval stores the seconds between two frames of the stream's sprites. It
// writes that one column, like SetDuration.
SetThumbInterval(streamID uint, seconds uint32) error
DeleteStream(streamID string)
// RemoveStream is DeleteStream that reports a failure, for callers that audit the delete.
RemoveStream(streamID string) error
DeleteStreamsWithTumID(ids []uint)
UpdateLectureSeries(model.Stream) error
UpdateLectureSeriesTime(model.Stream) error
DeleteLectureSeries(string) error
// The course-scoped series operations v2 uses. A copied lecture keeps its series
// identifier, so the identifier alone can name lectures in more than one course.
UpdateCourseLectureSeries(courseID uint, seriesIdentifier string, update LectureSeriesUpdate) error
UpdateCourseLectureSeriesTime(courseID, streamID uint, seriesIdentifier string, start, end time.Time) error
DeleteCourseLectureSeries(courseID uint, seriesIdentifier 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)
// GetLanguagesByStreamID returns the languages a stream has subtitles in, sorted.
GetLanguagesByStreamID(context.Context, uint) ([]string, 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)
GetTokenByID(id string) (model.Token, error)
GetAllTokens(user *model.User) ([]AllTokensDto, 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 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)
SearchUserWithRole(query string, role uint64) (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
// TouchLastLogin records a sign-in of the user, now.
TouchLastLogin(ctx context.Context, uid uint) error
AddUsersToCourseByTUMIDs(matrNr []string, courseID uint) error
}
func NewUsersDao ¶
func NewUsersDao() UsersDao
type VideoSectionDao ¶
type VideoSectionDao interface {
Create([]model.VideoSection) error
Update(*model.VideoSection) error
// UpdateContent writes the section's description and start, zero values included,
// which Update skips: it cannot move a section back to 0:00:00.
UpdateContent(*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
Source Files
¶
- audit.go
- bookmark.go
- cache.go
- chat.go
- courses.go
- dao_base.go
- dao_logger.go
- email.go
- file.go
- info-page.go
- ingest_server.go
- integration.go
- integration_grant.go
- lecture_cut.go
- lecture_halls.go
- media_reap.go
- migrator.go
- notifications.go
- progress.go
- runner.go
- server-notification.go
- statistics.go
- stream-reaction.go
- streams.go
- subtitles.go
- token.go
- transcoding-failure.go
- users.go
- video-section.go
- video-seek.go