Documentation ¶
Index ¶
- Constants
- func AddAdmin(u *model.User) error
- func AddAdminByID(userID string) error
- func AddMemberPermissions(roomID string, userID string, permission model.RoomMemberPermission) error
- func AddRoot(u *model.User) error
- func AddRootByID(userID string) error
- func BanUser(u *model.User) error
- func BanUserByID(userID string) error
- func BindEmail(id string, email string) error
- func BindProvider(uid string, p provider.OAuth2Provider, puid string) error
- func Close()
- func CreateMovie(movie *model.Movie) error
- func CreateMovies(movies []*model.Movie) error
- func CreateOrLoadRoomSettings(roomID string) (*model.RoomSettings, error)
- func CreateOrLoadUserWithProvider(username, password string, p provider.OAuth2Provider, puid string, ...) (*model.User, error)
- func CreateOrSaveAlistVendor(vendorInfo *model.AlistVendor) (*model.AlistVendor, error)
- func CreateOrSaveBilibiliVendor(vendorInfo *model.BilibiliVendor) (*model.BilibiliVendor, error)
- func CreateOrSaveEmbyVendor(vendorInfo *model.EmbyVendor) (*model.EmbyVendor, error)
- func CreateOrSaveVendorBackend(backend *model.VendorBackend) (*model.VendorBackend, error)
- func CreateRoom(name, password string, maxCount int64, conf ...CreateRoomConfig) (*model.Room, error)
- func CreateUser(username string, password string, conf ...CreateUserConfig) (*model.User, error)
- func CreateUserWithEmail(username, password, email string, conf ...CreateUserConfig) (*model.User, error)
- func CreateUserWithHashedPassword(username string, hashedPassword []byte, conf ...CreateUserConfig) (*model.User, error)
- func CreateVendorBackend(backend *model.VendorBackend) error
- func DB() *gorm.DB
- func DeleteAlistVendor(userID, serverID string) error
- func DeleteBilibiliVendor(userID string) error
- func DeleteEmbyVendor(userID, serverID string) error
- func DeleteMovieByID(roomID, id string) error
- func DeleteMoviesByID(roomID string, ids []string) error
- func DeleteMoviesByRoomID(roomID string, scopes ...func(*gorm.DB) *gorm.DB) error
- func DeleteMoviesByRoomIDAndParentID(roomID, parentID string) error
- func DeleteRoomByID(roomID string) error
- func DeleteRoomMember(roomID, userID string) error
- func DeleteSettingItem(item *model.Setting) error
- func DeleteSettingItemByName(name string) error
- func DeleteUserByID(userID string) error
- func DeleteVendorBackend(endpoint string) error
- func DeleteVendorBackends(endpoints []string) error
- func DisableVendorBackend(endpoint string) error
- func DisableVendorBackends(endpoints []string) error
- func EnableVendorBackend(endpoint string) error
- func EnableVendorBackends(endpoints []string) error
- func FirstOrCreateRoomMemberRelation(roomID, userID string, conf ...CreateRoomMemberRelationConfig) (*model.RoomMember, error)
- func FirstOrCreateSettingItemValue(s *model.Setting) error
- func GerUsersIDByIDLike(id string, scopes ...func(*gorm.DB) *gorm.DB) ([]string, error)
- func GerUsersIDByUsernameLike(username string, scopes ...func(*gorm.DB) *gorm.DB) ([]string, error)
- func GetAdmins() ([]*model.User, error)
- func GetAlistVendor(userID, serverID string) (*model.AlistVendor, error)
- func GetAlistVendors(userID string, scopes ...func(*gorm.DB) *gorm.DB) ([]*model.AlistVendor, error)
- func GetAlistVendorsCount(userID string, scopes ...func(*gorm.DB) *gorm.DB) (int64, error)
- func GetAllRooms(scopes ...func(*gorm.DB) *gorm.DB) ([]*model.Room, error)
- func GetAllRoomsAndCreator(scopes ...func(*gorm.DB) *gorm.DB) ([]*model.Room, error)
- func GetAllRoomsByUserID(userID string) ([]*model.Room, error)
- func GetAllRoomsCount(scopes ...func(*gorm.DB) *gorm.DB) (int64, error)
- func GetAllVendorBackend() ([]*model.VendorBackend, error)
- func GetBilibiliVendor(userID string) (*model.BilibiliVendor, error)
- func GetBindProviders(uid string) ([]*model.UserProvider, error)
- func GetEmbyFirstVendor(userID string) (*model.EmbyVendor, error)
- func GetEmbyVendor(userID, serverID string) (*model.EmbyVendor, error)
- func GetEmbyVendors(userID string, scopes ...func(*gorm.DB) *gorm.DB) ([]*model.EmbyVendor, error)
- func GetEmbyVendorsCount(userID string, scopes ...func(*gorm.DB) *gorm.DB) (int64, error)
- func GetMovieByID(roomID, id string, scopes ...func(*gorm.DB) *gorm.DB) (*model.Movie, error)
- func GetMoviesByRoomID(roomID string, scopes ...func(*gorm.DB) *gorm.DB) ([]*model.Movie, error)
- func GetMoviesCountByRoomID(roomID string, scopes ...func(*gorm.DB) *gorm.DB) (int64, error)
- func GetProviderUserID(p provider.OAuth2Provider, puid string) (string, error)
- func GetRoomByID(id string) (*model.Room, error)
- func GetRoomMember(roomID, userID string) (*model.RoomMember, error)
- func GetRoomMembers(roomID string, scopes ...func(*gorm.DB) *gorm.DB) ([]*model.RoomMember, error)
- func GetRoomMembersCount(roomID string, scopes ...func(*gorm.DB) *gorm.DB) (int64, error)
- func GetRoots() []*model.User
- func GetSettingItemByName(name string) (*model.Setting, error)
- func GetSettingItemValue(name string) (string, error)
- func GetSettingItems() ([]*model.Setting, error)
- func GetSettingItemsToMap() (map[string]*model.Setting, error)
- func GetUserByEmail(email string) (*model.User, error)
- func GetUserByID(id string) (*model.User, error)
- func GetUserByIDOrUsernameLike(idOrUsername string, scopes ...func(*gorm.DB) *gorm.DB) ([]*model.User, error)
- func GetUserByProvider(p provider.OAuth2Provider, puid string) (*model.User, error)
- func GetUserByUsername(username string) (*model.User, error)
- func GetUserByUsernameLike(username string, scopes ...func(*gorm.DB) *gorm.DB) ([]*model.User, error)
- func GetUserCount(scopes ...func(*gorm.DB) *gorm.DB) (int64, error)
- func GetUsers(scopes ...func(*gorm.DB) *gorm.DB) ([]*model.User, error)
- func GetVendorBackend(endpoint string) (*model.VendorBackend, error)
- func HandleNotFound(err error, errMsg ...string) error
- func HandleUpdateResult(result *gorm.DB, entityName string) error
- func Init(d *gorm.DB, t conf.DatabaseType) error
- func LoadAndDeleteUserByID(userID string, columns ...clause.Column) (*model.User, error)
- func OnConflictDoNothing() *gorm.DB
- 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 OrderByRoomCreatedAtAsc(db *gorm.DB) *gorm.DB
- func OrderByRoomCreatedAtDesc(db *gorm.DB) *gorm.DB
- func OrderByUsersCreatedAtAsc(db *gorm.DB) *gorm.DB
- func OrderByUsersCreatedAtDesc(db *gorm.DB) *gorm.DB
- func Paginate(page, pageSize int) func(db *gorm.DB) *gorm.DB
- func PreloadRoomMembers(scopes ...func(*gorm.DB) *gorm.DB) func(db *gorm.DB) *gorm.DB
- func PreloadUserProviders(scopes ...func(*gorm.DB) *gorm.DB) func(db *gorm.DB) *gorm.DB
- func RemoveAdmin(u *model.User) error
- func RemoveAdminByID(userID string) error
- func RemoveMemberPermissions(roomID string, userID string, permission model.RoomMemberPermission) error
- func RemoveRoot(u *model.User) error
- func RemoveRootByID(userID string) error
- func RoomAddAdminPermissions(roomID, userID string, permissions model.RoomAdminPermission) error
- func RoomApprovePendingMember(roomID, userID string) error
- func RoomBanMember(roomID, userID string) error
- func RoomRemoveAdminPermissions(roomID, userID string, permissions model.RoomAdminPermission) error
- func RoomSetAdmin(roomID, userID string, permissions model.RoomAdminPermission) error
- func RoomSetAdminPermissions(roomID, userID string, permissions model.RoomAdminPermission) error
- func RoomSetMember(roomID, userID string, permissions model.RoomMemberPermission) error
- func RoomUnbanMember(roomID, userID string) error
- func SaveMovie(movie *model.Movie, columns ...clause.Column) error
- func SaveRoomSettings(roomID string, settings *model.RoomSettings) error
- func SaveSettingItem(item *model.Setting) error
- func SaveUser(u *model.User) error
- func SaveVendorBackend(backend *model.VendorBackend) error
- func Select(columns ...string) func(db *gorm.DB) *gorm.DB
- func SetAdminRoleByID(userID string) error
- func SetMemberPermissions(roomID string, userID string, permission model.RoomMemberPermission) 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 SetRootRoleByID(userID string) error
- func SetUserHashedPassword(id string, hashedPassword []byte) error
- func SetUserRoleByID(userID string) error
- func SetUsernameByID(userID string, username string) error
- func SwapMoviePositions(roomID, movie1ID, movie2ID string) error
- func Transactional(txFunc func(*gorm.DB) error) (err error)
- func UnBindProvider(uid string, p provider.OAuth2Provider) error
- func UnbanUser(u *model.User) error
- func UnbanUserByID(userID string) error
- func UnbindEmail(uid string) error
- func UpdateMovie(movie *model.Movie, columns ...clause.Column) error
- func UpdateRoomSettings(roomID string, settings map[string]interface{}) (*model.RoomSettings, error)
- func UpdateSettingItemValue(name, value string) error
- func UpgradeDatabase() 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 WhereRoomMemberRole(role model.RoomMemberRole) func(db *gorm.DB) *gorm.DB
- func WhereRoomMemberStatus(status model.RoomMemberStatus) 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 WhereRoomNameLikeOrCreatorInOrRoomsIDLike(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 WhereRoomSettingWithoutHidden() func(db *gorm.DB) *gorm.DB
- func WhereRoomsIDLike(id string) 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 WithParentMovieID(parentMovieID string) func(*gorm.DB) *gorm.DB
- func WithUser(db *gorm.DB) *gorm.DB
- type CreateRoomConfig
- type CreateRoomMemberRelationConfig
- func WithRoomMemberAdminPermissions(permissions model.RoomAdminPermission) CreateRoomMemberRelationConfig
- func WithRoomMemberPermissions(permissions model.RoomMemberPermission) CreateRoomMemberRelationConfig
- func WithRoomMemberRole(role model.RoomMemberRole) CreateRoomMemberRelationConfig
- func WithRoomMemberStatus(status model.RoomMemberStatus) CreateRoomMemberRelationConfig
- type CreateUserConfig
- type ErrNotFound
Constants ¶
View Source
const ( GuestUsername = "guest" GuestUserID = "00000000000000000000000000000001" )
View Source
const CurrentVersion = "0.0.10"
View Source
const (
ErrRoomMemberNotFound = "room or member"
)
View Source
const (
ErrRoomNotFound = "room"
)
View Source
const (
ErrRoomOrMovieNotFound = "room or movie"
)
View Source
const (
ErrSettingNotFound = "setting"
)
View Source
const (
ErrUserNotFound = "user"
)
View Source
const (
ErrVendorNotFound = "vendor"
)
Variables ¶
This section is empty.
Functions ¶
func AddAdminByID ¶
func AddMemberPermissions ¶ added in v0.5.0
func AddMemberPermissions(roomID string, userID string, permission model.RoomMemberPermission) error
func AddRootByID ¶
func BanUserByID ¶
func BindProvider ¶
func BindProvider(uid string, p provider.OAuth2Provider, puid string) error
func CreateMovie ¶
func CreateMovies ¶
func CreateOrLoadRoomSettings ¶ added in v0.7.0
func CreateOrLoadRoomSettings(roomID string) (*model.RoomSettings, error)
func CreateOrLoadUserWithProvider ¶
func CreateOrLoadUserWithProvider(username, password string, p provider.OAuth2Provider, puid string, conf ...CreateUserConfig) (*model.User, error)
func CreateOrSaveAlistVendor ¶ added in v0.3.1
func CreateOrSaveAlistVendor(vendorInfo *model.AlistVendor) (*model.AlistVendor, error)
func CreateOrSaveBilibiliVendor ¶ added in v0.3.1
func CreateOrSaveBilibiliVendor(vendorInfo *model.BilibiliVendor) (*model.BilibiliVendor, error)
func CreateOrSaveEmbyVendor ¶ added in v0.3.1
func CreateOrSaveEmbyVendor(vendorInfo *model.EmbyVendor) (*model.EmbyVendor, error)
func CreateOrSaveVendorBackend ¶ added in v0.3.1
func CreateOrSaveVendorBackend(backend *model.VendorBackend) (*model.VendorBackend, error)
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 CreateUserWithEmail ¶ added in v0.4.5
func CreateUserWithEmail(username, password, email string, conf ...CreateUserConfig) (*model.User, error)
func CreateVendorBackend ¶ added in v0.3.1
func CreateVendorBackend(backend *model.VendorBackend) error
func DeleteAlistVendor ¶ added in v0.3.1
func DeleteBilibiliVendor ¶ added in v0.3.1
func DeleteEmbyVendor ¶ added in v0.3.1
func DeleteMovieByID ¶
func DeleteMoviesByID ¶ added in v0.5.0
func DeleteMoviesByRoomID ¶
func DeleteMoviesByRoomIDAndParentID ¶ added in v0.6.0
func DeleteRoomByID ¶
func DeleteRoomMember ¶ added in v0.7.0
func DeleteSettingItem ¶
func DeleteSettingItemByName ¶
func DeleteUserByID ¶
func DeleteVendorBackend ¶ added in v0.3.1
func DeleteVendorBackends ¶ added in v0.3.1
func DisableVendorBackend ¶ added in v0.3.1
func DisableVendorBackends ¶ added in v0.3.1
func EnableVendorBackend ¶ added in v0.3.1
func EnableVendorBackends ¶ added in v0.3.1
func FirstOrCreateRoomMemberRelation ¶ added in v0.5.0
func FirstOrCreateRoomMemberRelation(roomID, userID string, conf ...CreateRoomMemberRelationConfig) (*model.RoomMember, error)
func GerUsersIDByIDLike ¶
func GetAlistVendor ¶ added in v0.3.1
func GetAlistVendor(userID, serverID string) (*model.AlistVendor, error)
func GetAlistVendors ¶ added in v0.3.2
func GetAlistVendorsCount ¶ added in v0.3.2
func GetAllRoomsAndCreator ¶
func GetAllVendorBackend ¶ added in v0.3.1
func GetAllVendorBackend() ([]*model.VendorBackend, error)
func GetBilibiliVendor ¶ added in v0.3.1
func GetBilibiliVendor(userID string) (*model.BilibiliVendor, error)
func GetBindProviders ¶
func GetBindProviders(uid string) ([]*model.UserProvider, error)
func GetEmbyFirstVendor ¶ added in v0.3.2
func GetEmbyFirstVendor(userID string) (*model.EmbyVendor, error)
func GetEmbyVendor ¶ added in v0.3.1
func GetEmbyVendor(userID, serverID string) (*model.EmbyVendor, error)
func GetEmbyVendors ¶ added in v0.3.2
func GetEmbyVendorsCount ¶ added in v0.3.2
func GetMovieByID ¶ added in v0.6.0
func GetMoviesByRoomID ¶ added in v0.6.0
func GetMoviesCountByRoomID ¶ added in v0.6.0
func GetProviderUserID ¶
func GetProviderUserID(p provider.OAuth2Provider, puid string) (string, error)
func GetRoomMember ¶ added in v0.5.0
func GetRoomMember(roomID, userID string) (*model.RoomMember, error)
func GetRoomMembers ¶ added in v0.7.0
func GetRoomMembersCount ¶ added in v0.7.0
func GetSettingItemValue ¶
func GetSettingItems ¶
func GetSettingItemsToMap ¶ added in v0.3.2
func GetUserByProvider ¶
func GetUserByUsernameLike ¶
func GetUserCount ¶ added in v0.7.0
func GetVendorBackend ¶ added in v0.3.1
func GetVendorBackend(endpoint string) (*model.VendorBackend, error)
func HandleNotFound ¶ added in v0.3.1
func HandleUpdateResult ¶ added in v0.7.0
Helper function to handle update results
func LoadAndDeleteUserByID ¶
func OnConflictDoNothing ¶ added in v0.7.0
func OrderByUsersCreatedAtDesc ¶ added in v0.5.0
func PreloadRoomMembers ¶ added in v0.5.0
func PreloadUserProviders ¶
func RemoveAdmin ¶
func RemoveAdminByID ¶
func RemoveMemberPermissions ¶ added in v0.5.0
func RemoveMemberPermissions(roomID string, userID string, permission model.RoomMemberPermission) error
func RemoveRoot ¶
func RemoveRootByID ¶
func RoomAddAdminPermissions ¶ added in v0.5.0
func RoomAddAdminPermissions(roomID, userID string, permissions model.RoomAdminPermission) error
func RoomApprovePendingMember ¶ added in v0.5.0
func RoomBanMember ¶ added in v0.5.0
func RoomRemoveAdminPermissions ¶ added in v0.5.0
func RoomRemoveAdminPermissions(roomID, userID string, permissions model.RoomAdminPermission) error
func RoomSetAdmin ¶ added in v0.5.0
func RoomSetAdmin(roomID, userID string, permissions model.RoomAdminPermission) error
func RoomSetAdminPermissions ¶ added in v0.5.0
func RoomSetAdminPermissions(roomID, userID string, permissions model.RoomAdminPermission) error
func RoomSetMember ¶ added in v0.5.0
func RoomSetMember(roomID, userID string, permissions model.RoomMemberPermission) error
func RoomUnbanMember ¶ added in v0.5.0
func SaveRoomSettings ¶
func SaveRoomSettings(roomID string, settings *model.RoomSettings) error
func SaveSettingItem ¶
func SaveVendorBackend ¶ added in v0.3.1
func SaveVendorBackend(backend *model.VendorBackend) error
func SetAdminRoleByID ¶ added in v0.5.0
func SetMemberPermissions ¶ added in v0.5.0
func SetMemberPermissions(roomID string, userID string, permission model.RoomMemberPermission) error
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 SetRootRoleByID ¶ added in v0.5.0
func SetUserHashedPassword ¶
func SetUserRoleByID ¶ added in v0.5.0
func SetUsernameByID ¶
func SwapMoviePositions ¶
func UnBindProvider ¶
func UnBindProvider(uid string, p provider.OAuth2Provider) error
func UnbanUserByID ¶
func UnbindEmail ¶ added in v0.4.5
func UpdateRoomSettings ¶ added in v0.5.0
func UpdateRoomSettings(roomID string, settings map[string]interface{}) (*model.RoomSettings, error)
func UpdateSettingItemValue ¶
func UpgradeDatabase ¶ added in v0.3.2
func UpgradeDatabase() error
func WhereEqual ¶
column cannot be a user parameter
func WhereRoomMemberRole ¶ added in v0.5.0
func WhereRoomMemberStatus ¶ added in v0.5.0
func WhereRoomNameLikeOrCreatorInOrRoomsIDLike ¶ added in v0.5.0
func WhereStatus ¶
func WhereUsernameLikeOrIDIn ¶
func WithParentMovieID ¶ added in v0.6.0
Types ¶
type CreateRoomConfig ¶
func WithCreator ¶
func WithCreator(creator *model.User) CreateRoomConfig
func WithRelations ¶
func WithRelations(relations []*model.RoomMember) CreateRoomConfig
func WithSetting ¶
func WithSetting(setting *model.RoomSettings) CreateRoomConfig
func WithSettingHidden ¶ added in v0.5.0
func WithSettingHidden(hidden bool) CreateRoomConfig
func WithStatus ¶
func WithStatus(status model.RoomStatus) CreateRoomConfig
type CreateRoomMemberRelationConfig ¶ added in v0.5.0
type CreateRoomMemberRelationConfig func(r *model.RoomMember)
func WithRoomMemberAdminPermissions ¶ added in v0.5.0
func WithRoomMemberAdminPermissions(permissions model.RoomAdminPermission) CreateRoomMemberRelationConfig
func WithRoomMemberPermissions ¶ added in v0.5.0
func WithRoomMemberPermissions(permissions model.RoomMemberPermission) CreateRoomMemberRelationConfig
func WithRoomMemberRole ¶ added in v0.5.0
func WithRoomMemberRole(role model.RoomMemberRole) CreateRoomMemberRelationConfig
func WithRoomMemberStatus ¶ added in v0.5.0
func WithRoomMemberStatus(status model.RoomMemberStatus) CreateRoomMemberRelationConfig
type CreateUserConfig ¶
func WithDisableAutoAddUsernameSuffix ¶ added in v0.7.0
func WithDisableAutoAddUsernameSuffix() CreateUserConfig
func WithEnableAutoAddUsernameSuffix ¶ added in v0.7.0
func WithEnableAutoAddUsernameSuffix() CreateUserConfig
func WithID ¶ added in v0.5.0
func WithID(id string) CreateUserConfig
func WithRegisteredByEmail ¶ added in v0.4.5
func WithRegisteredByEmail(email string) CreateUserConfig
func WithRole ¶
func WithRole(role model.Role) CreateUserConfig
type ErrNotFound ¶ added in v0.3.1
type ErrNotFound string
func (ErrNotFound) Error ¶ added in v0.3.1
func (e ErrNotFound) Error() string
Click to show internal directories.
Click to hide internal directories.