Documentation ¶
Index ¶
- Constants
- 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 BanUser(u *model.User) error
- func BanUserByID(userID 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 CreateOrLoadUser(username string, password string, conf ...CreateUserConfig) (*model.User, error)
- func CreateOrLoadUserWithHashedPassword(username string, hashedPassword []byte, conf ...CreateUserConfig) (*model.User, 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 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 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 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 FirstOrCreateRoomUserRelation(roomID, userID string, conf ...CreateRoomUserRelationConfig) (*model.RoomUserRelation, error)
- func FirstOrCreateSettingItemValue(s *model.Setting) 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 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 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 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 GetProviderUserID(p provider.OAuth2Provider, puid string) (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 GetSettingItemsToMap() (map[string]*model.Setting, 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
- func GetVendorBackend(endpoint string) (*model.VendorBackend, error)
- func HandleNotFound(err error, errMsg ...string) 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 PreloadRoomUserRelations(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 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 SaveVendorBackend(backend *model.VendorBackend) 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 SetUserHashedPassword(id string, hashedPassword []byte) 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 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 UpdateMovie(movie *model.Movie, columns ...clause.Column) 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 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
- type CreateRoomConfig
- type CreateRoomUserRelationConfig
- type CreateUserConfig
- func WithAppendProvider(p provider.OAuth2Provider, puid string) CreateUserConfig
- func WithAppendProviders(providers []model.UserProvider) CreateUserConfig
- func WithRegisteredByProvider(b bool) CreateUserConfig
- func WithRole(role model.Role) CreateUserConfig
- func WithSetProvider(p provider.OAuth2Provider, puid string) CreateUserConfig
- func WithSetProviders(providers []model.UserProvider) CreateUserConfig
- type ErrNotFound
Constants ¶
View Source
const CurrentVersion = "0.0.2"
Variables ¶
This section is empty.
Functions ¶
func AddAdminByID ¶
func AddRootByID ¶
func AddUserPermission ¶
func AddUserPermission(roomID string, userID string, permission model.RoomUserPermission) error
func BanUserByID ¶
func BindProvider ¶
func BindProvider(uid string, p provider.OAuth2Provider, puid string) error
func CreateMovie ¶
func CreateMovies ¶
func CreateOrLoadUser ¶
func CreateOrLoadUserWithProvider ¶
func CreateOrLoadUserWithProvider(username, password string, p provider.OAuth2Provider, puid string, conf ...CreateUserConfig) (*model.User, error)
只有当provider和puid没有找到对应的user时才会创建
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 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 DeleteMoviesByRoomID ¶
func DeleteRoomByID ¶
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 FirstOrCreateRoomUserRelation ¶
func FirstOrCreateRoomUserRelation(roomID, userID string, conf ...CreateRoomUserRelationConfig) (*model.RoomUserRelation, 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 GetAllMoviesByRoomID ¶
func GetAllRoomUsersRelation ¶
func GetAllRoomsAndCreator ¶
func GetAllRoomsByUserID ¶
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 GetProviderUserID ¶
func GetProviderUserID(p provider.OAuth2Provider, puid string) (string, error)
func GetRoomUserRelation ¶
func GetRoomUserRelation(roomID, userID string) (*model.RoomUserRelation, error)
func GetSettingItemValue ¶
func GetSettingItems ¶
func GetSettingItemsToMap ¶ added in v0.3.2
func GetUserByProvider ¶
func GetUserByUsernameLike ¶
func GetVendorBackend ¶ added in v0.3.1
func GetVendorBackend(endpoint string) (*model.VendorBackend, error)
func HandleNotFound ¶ added in v0.3.1
func LoadAndDeleteMovieByID ¶
func LoadAndDeleteUserByID ¶
func PreloadUserProviders ¶
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 SaveVendorBackend ¶ added in v0.3.1
func SaveVendorBackend(backend *model.VendorBackend) 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 SetRoomUserStatus ¶
func SetRoomUserStatus(roomID string, userID string, status model.RoomUserStatus) error
func SetUserHashedPassword ¶
func SetUserPermission ¶
func SetUserPermission(roomID string, userID string, permission model.RoomUserPermission) error
func SetUsernameByID ¶
func SwapMoviePositions ¶
func UnBindProvider ¶
func UnBindProvider(uid string, p provider.OAuth2Provider) error
当用户是通过provider注册的时候,则最少保留一个provider,否则禁止解除绑定
func UnbanUserByID ¶
func UpdateSettingItemValue ¶
func UpgradeDatabase ¶ added in v0.3.2
func UpgradeDatabase() error
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 WithAppendProvider ¶
func WithAppendProvider(p provider.OAuth2Provider, puid string) CreateUserConfig
func WithAppendProviders ¶
func WithAppendProviders(providers []model.UserProvider) CreateUserConfig
func WithRegisteredByProvider ¶
func WithRegisteredByProvider(b bool) CreateUserConfig
func WithRole ¶
func WithRole(role model.Role) CreateUserConfig
func WithSetProvider ¶
func WithSetProvider(p provider.OAuth2Provider, puid string) CreateUserConfig
func WithSetProviders ¶
func WithSetProviders(providers []model.UserProvider) 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.