Documentation
¶
Index ¶
- func AddAdmin(u *model.User) error
- func AddAdminByID(userID string) error
- func AddRoot(u *model.User) error
- func AddRootByID(userID string) error
- func AddUserPermission(roomID string, userID string, permission model.RoomUserPermission) error
- func AssignFirstOrCreateVendorByUserIDAndVendor(userID string, vendor model.StreamingVendor, conf ...CreateVendorConfig) (*model.StreamingVendorInfo, error)
- func AutoMigrate(dst ...any) error
- func BanUser(u *model.User) error
- func BanUserByID(userID string) error
- func Close()
- func CreateMovie(movie *model.Movie) error
- func CreateMovies(movies []*model.Movie) error
- func CreateOrLoadUser(username string, p provider.OAuth2Provider, puid uint64, ...) (*model.User, error)
- func CreateRoom(name, password string, maxCount int64, conf ...CreateRoomConfig) (*model.Room, error)
- func CreateUser(username string, p provider.OAuth2Provider, puid uint64, ...) (*model.User, error)
- func DB() *gorm.DB
- func DeleteMovieByID(roomID, id string) error
- func DeleteMoviesByRoomID(roomID string) error
- func DeleteRoomByID(roomID string) error
- func DeleteSettingItem(item *model.Setting) error
- func DeleteSettingItemByName(name string) error
- func DeleteUserByID(userID string) error
- func DeleteVendorByUserIDAndVendor(userID string, vendor model.StreamingVendor) error
- func FirstOrCreateRoomUserRelation(roomID, userID string, conf ...CreateRoomUserRelationConfig) (*model.RoomUserRelation, error)
- func FirstOrCreateSettingItemValue(s *model.Setting) error
- func FirstOrCreateVendorByUserIDAndVendor(userID string, vendor model.StreamingVendor, conf ...CreateVendorConfig) (*model.StreamingVendorInfo, error)
- func FirstOrInitVendorByUserIDAndVendor(userID string, vendor model.StreamingVendor, conf ...CreateVendorConfig) (*model.StreamingVendorInfo, error)
- func GerUsersIDByIDLike(id string, scopes ...func(*gorm.DB) *gorm.DB) []string
- func GerUsersIDByUsernameLike(username string, scopes ...func(*gorm.DB) *gorm.DB) []string
- func GetAdmins() []*model.User
- func GetAllMoviesByRoomID(roomID string) []*model.Movie
- func GetAllRoomUsersRelation(roomID string, scopes ...func(*gorm.DB) *gorm.DB) []*model.RoomUserRelation
- func GetAllRoomUsersRelationCount(roomID string, scopes ...func(*gorm.DB) *gorm.DB) int64
- func GetAllRooms(scopes ...func(*gorm.DB) *gorm.DB) []*model.Room
- func GetAllRoomsAndCreator(scopes ...func(*gorm.DB) *gorm.DB) []*model.Room
- func GetAllRoomsByUserID(userID string) []*model.Room
- func GetAllRoomsCount(scopes ...func(*gorm.DB) *gorm.DB) int64
- func GetAllUserCount(scopes ...func(*gorm.DB) *gorm.DB) int64
- func GetAllUsers(scopes ...func(*gorm.DB) *gorm.DB) []*model.User
- func GetProviderUserID(p provider.OAuth2Provider, puid uint64) (string, error)
- func GetRoomByID(id string) (*model.Room, error)
- func GetRoomUserRelation(roomID, userID string) (*model.RoomUserRelation, error)
- func GetRoots() []*model.User
- func GetSettingItemByName(name string) (*model.Setting, error)
- func GetSettingItemValue(name string) (string, error)
- func GetSettingItems() ([]*model.Setting, error)
- func GetUserByID(id string) (*model.User, error)
- func GetUserByIDOrUsernameLike(idOrUsername string, scopes ...func(*gorm.DB) *gorm.DB) ([]*model.User, error)
- func GetUserByUsername(username string) (*model.User, error)
- func GetUserByUsernameLike(username string, scopes ...func(*gorm.DB) *gorm.DB) []*model.User
- func GetVendorByUserID(userID string) ([]*model.StreamingVendorInfo, error)
- func GetVendorByUserIDAndVendor(userID string, vendor model.StreamingVendor) (*model.StreamingVendorInfo, error)
- func HasRoom(roomID string) (bool, error)
- func HasRoomByName(name string) (bool, error)
- func Init(d *gorm.DB, t conf.DatabaseType) error
- func LoadAndDeleteMovieByID(roomID, id string, columns ...clause.Column) (*model.Movie, error)
- func LoadAndDeleteMoviesByRoomID(roomID string, columns ...clause.Column) ([]*model.Movie, error)
- func LoadAndDeleteUserByID(userID string, columns ...clause.Column) (*model.User, error)
- func OrderByAsc(column string) func(db *gorm.DB) *gorm.DB
- func OrderByCreatedAtAsc(db *gorm.DB) *gorm.DB
- func OrderByCreatedAtDesc(db *gorm.DB) *gorm.DB
- func OrderByDesc(column string) func(db *gorm.DB) *gorm.DB
- func OrderByIDAsc(db *gorm.DB) *gorm.DB
- func OrderByIDDesc(db *gorm.DB) *gorm.DB
- func Paginate(page, pageSize int) func(db *gorm.DB) *gorm.DB
- func PreloadRoomUserRelation(scopes ...func(*gorm.DB) *gorm.DB) func(db *gorm.DB) *gorm.DB
- func RemoveAdmin(u *model.User) error
- func RemoveAdminByID(userID string) error
- func RemoveRoot(u *model.User) error
- func RemoveRootByID(userID string) error
- func RemoveUserPermission(roomID string, userID string, permission model.RoomUserPermission) error
- func SaveMovie(movie *model.Movie, columns ...clause.Column) error
- func SaveRoomSettings(roomID string, setting model.RoomSettings) error
- func SaveSettingItem(item *model.Setting) error
- func SaveUser(u *model.User) error
- func Select(columns ...string) func(db *gorm.DB) *gorm.DB
- func SetRole(u *model.User, role model.Role) error
- func SetRoleByID(userID string, role model.Role) error
- func SetRoomHashedPassword(roomID string, hashedPassword []byte) error
- func SetRoomPassword(roomID, password string) error
- func SetRoomStatus(roomID string, status model.RoomStatus) error
- func SetRoomStatusByCreator(userID string, status model.RoomStatus) error
- func SetRoomUserStatus(roomID string, userID string, status model.RoomUserStatus) error
- func SetUserPermission(roomID string, userID string, permission model.RoomUserPermission) error
- func SetUsernameByID(userID string, username string) error
- func SwapMoviePositions(roomID, movie1ID, movie2ID string) (err error)
- func UnbanUser(u *model.User) error
- func UnbanUserByID(userID string) error
- func UpdateMovie(movie *model.Movie, columns ...clause.Column) error
- func UpdateSettingItemValue(name, value string) error
- func WhereCreatorID(creatorID string) func(db *gorm.DB) *gorm.DB
- func WhereCreatorIDIn(ids []string) func(db *gorm.DB) *gorm.DB
- func WhereEqual(column string, value interface{}) func(db *gorm.DB) *gorm.DB
- func WhereIDIn(ids []string) func(db *gorm.DB) *gorm.DB
- func WhereIDLike(id string) func(db *gorm.DB) *gorm.DB
- func WhereLike(column string, value string) func(db *gorm.DB) *gorm.DB
- func WhereRole(role model.Role) func(db *gorm.DB) *gorm.DB
- func WhereRoomID(roomID string) func(db *gorm.DB) *gorm.DB
- func WhereRoomNameLike(name string) func(db *gorm.DB) *gorm.DB
- func WhereRoomNameLikeOrCreatorInOrIDLike(name string, ids []string, id string) func(db *gorm.DB) *gorm.DB
- func WhereRoomNameLikeOrIDLike(name string, id string) func(db *gorm.DB) *gorm.DB
- func WhereRoomSettingHidden() func(db *gorm.DB) *gorm.DB
- func WhereRoomSettingWithoutHidden() func(db *gorm.DB) *gorm.DB
- func WhereRoomUserStatus(status model.RoomUserStatus) func(db *gorm.DB) *gorm.DB
- func WhereStatus(status model.RoomStatus) func(db *gorm.DB) *gorm.DB
- func WhereUserID(userID string) func(db *gorm.DB) *gorm.DB
- func WhereUsernameLike(name string) func(db *gorm.DB) *gorm.DB
- func WhereUsernameLikeOrIDIn(name string, ids []string) func(db *gorm.DB) *gorm.DB
- func WithUser(db *gorm.DB) *gorm.DB
- func WithUserAndProvider(db *gorm.DB) *gorm.DB
- type CreateRoomConfig
- type CreateRoomUserRelationConfig
- type CreateUserConfig
- type CreateVendorConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddAdminByID ¶
func AddRootByID ¶
func AddUserPermission ¶
func AddUserPermission(roomID string, userID string, permission model.RoomUserPermission) error
func AssignFirstOrCreateVendorByUserIDAndVendor ¶
func AssignFirstOrCreateVendorByUserIDAndVendor(userID string, vendor model.StreamingVendor, conf ...CreateVendorConfig) (*model.StreamingVendorInfo, error)
func AutoMigrate ¶
func BanUserByID ¶
func CreateMovie ¶
func CreateMovies ¶
func CreateOrLoadUser ¶
func CreateOrLoadUser(username string, p provider.OAuth2Provider, puid uint64, conf ...CreateUserConfig) (*model.User, error)
只有当provider和puid没有找到对应的user时才会创建
func CreateRoom ¶
func CreateRoom(name, password string, maxCount int64, conf ...CreateRoomConfig) (*model.Room, error)
if maxCount is 0, it will be ignored
func CreateUser ¶
func CreateUser(username string, p provider.OAuth2Provider, puid uint64, conf ...CreateUserConfig) (*model.User, error)
func DeleteMovieByID ¶
func DeleteMoviesByRoomID ¶
func DeleteRoomByID ¶
func DeleteSettingItem ¶
func DeleteSettingItemByName ¶
func DeleteUserByID ¶
func DeleteVendorByUserIDAndVendor ¶
func DeleteVendorByUserIDAndVendor(userID string, vendor model.StreamingVendor) error
func FirstOrCreateRoomUserRelation ¶
func FirstOrCreateRoomUserRelation(roomID, userID string, conf ...CreateRoomUserRelationConfig) (*model.RoomUserRelation, error)
func FirstOrCreateVendorByUserIDAndVendor ¶
func FirstOrCreateVendorByUserIDAndVendor(userID string, vendor model.StreamingVendor, conf ...CreateVendorConfig) (*model.StreamingVendorInfo, error)
func FirstOrInitVendorByUserIDAndVendor ¶
func FirstOrInitVendorByUserIDAndVendor(userID string, vendor model.StreamingVendor, conf ...CreateVendorConfig) (*model.StreamingVendorInfo, error)
func GerUsersIDByIDLike ¶
func GetAllMoviesByRoomID ¶
func GetAllRoomUsersRelation ¶
func GetAllRoomsAndCreator ¶
func GetAllRoomsByUserID ¶
func GetProviderUserID ¶
func GetProviderUserID(p provider.OAuth2Provider, puid uint64) (string, error)
func GetRoomUserRelation ¶
func GetRoomUserRelation(roomID, userID string) (*model.RoomUserRelation, error)
func GetSettingItemValue ¶
func GetSettingItems ¶
func GetUserByUsernameLike ¶
func GetVendorByUserID ¶
func GetVendorByUserID(userID string) ([]*model.StreamingVendorInfo, error)
func GetVendorByUserIDAndVendor ¶
func GetVendorByUserIDAndVendor(userID string, vendor model.StreamingVendor) (*model.StreamingVendorInfo, error)
func HasRoomByName ¶
func LoadAndDeleteMovieByID ¶
func LoadAndDeleteUserByID ¶
func PreloadRoomUserRelation ¶
func RemoveAdmin ¶
func RemoveAdminByID ¶
func RemoveRoot ¶
func RemoveRootByID ¶
func RemoveUserPermission ¶
func RemoveUserPermission(roomID string, userID string, permission model.RoomUserPermission) error
func SaveRoomSettings ¶
func SaveRoomSettings(roomID string, setting model.RoomSettings) error
func SaveSettingItem ¶
func SetRoomHashedPassword ¶
func SetRoomPassword ¶
func SetRoomStatus ¶
func SetRoomStatus(roomID string, status model.RoomStatus) error
func SetRoomStatusByCreator ¶
func SetRoomStatusByCreator(userID string, status model.RoomStatus) error
func SetRoomUserStatus ¶
func SetRoomUserStatus(roomID string, userID string, status model.RoomUserStatus) error
func SetUserPermission ¶
func SetUserPermission(roomID string, userID string, permission model.RoomUserPermission) error
func SetUsernameByID ¶
func SwapMoviePositions ¶
func UnbanUserByID ¶
func UpdateSettingItemValue ¶
func WhereEqual ¶
column cannot be a user parameter
func WhereRoomUserStatus ¶
func WhereStatus ¶
func WhereUsernameLikeOrIDIn ¶
Types ¶
type CreateRoomConfig ¶
func WithCreator ¶
func WithCreator(creator *model.User) CreateRoomConfig
func WithRelations ¶
func WithRelations(relations []model.RoomUserRelation) CreateRoomConfig
func WithSetting ¶
func WithSetting(setting model.RoomSettings) CreateRoomConfig
func WithStatus ¶
func WithStatus(status model.RoomStatus) CreateRoomConfig
type CreateRoomUserRelationConfig ¶
type CreateRoomUserRelationConfig func(r *model.RoomUserRelation)
func WithRoomUserRelationPermissions ¶
func WithRoomUserRelationPermissions(permissions model.RoomUserPermission) CreateRoomUserRelationConfig
func WithRoomUserRelationStatus ¶
func WithRoomUserRelationStatus(status model.RoomUserStatus) CreateRoomUserRelationConfig
type CreateUserConfig ¶
func WithRole ¶
func WithRole(role model.Role) CreateUserConfig
type CreateVendorConfig ¶
type CreateVendorConfig func(*model.StreamingVendorInfo)
func WithCookie ¶
func WithCookie(cookie []*http.Cookie) CreateVendorConfig
Click to show internal directories.
Click to hide internal directories.