Documentation
¶
Index ¶
- Constants
- Variables
- type BaseMovie
- type BilibiliVendorInfo
- type Movie
- type Role
- type Room
- type RoomSettings
- type RoomStatus
- type RoomUserPermission
- type RoomUserRelation
- type RoomUserStatus
- type Setting
- type SettingGroup
- type SettingType
- type StreamingVendor
- type StreamingVendorInfo
- type User
- type UserProvider
- type VendorInfo
- type VendorToken
Constants ¶
View Source
const (
DefaultPermissions = PermissionCreateMovie | PermissionEditCurrent | PermissionSendChat
)
Variables ¶
View Source
var ErrNoPermission = errors.New("no permission")
Functions ¶
This section is empty.
Types ¶
type BaseMovie ¶
type BaseMovie struct { Url string `json:"url"` Name string `gorm:"not null" json:"name"` Live bool `json:"live"` Proxy bool `json:"proxy"` RtmpSource bool `json:"rtmpSource"` Type string `json:"type"` Headers map[string]string `gorm:"serializer:fastjson" json:"headers"` VendorInfo VendorInfo `gorm:"embedded;embeddedPrefix:vendor_info_" json:"vendorInfo,omitempty"` }
type BilibiliVendorInfo ¶
type BilibiliVendorInfo struct { Bvid string `json:"bvid,omitempty"` Cid uint64 `json:"cid,omitempty"` Epid uint64 `json:"epid,omitempty"` Quality uint64 `json:"quality,omitempty"` VendorName string `json:"vendorName,omitempty"` }
func (*BilibiliVendorInfo) Validate ¶
func (b *BilibiliVendorInfo) Validate() error
type Movie ¶
type Movie struct { ID string `gorm:"primaryKey;type:varchar(32)" json:"id"` CreatedAt time.Time `json:"-"` UpdatedAt time.Time `json:"-"` Position uint `gorm:"not null" json:"-"` RoomID string `gorm:"not null;index" json:"-"` CreatorID string `gorm:"index" json:"creatorId"` Base BaseMovie `gorm:"embedded;embeddedPrefix:base_" json:"base"` }
type Room ¶
type Room struct { ID string `gorm:"not null;primaryKey;type:varchar(32)" json:"id"` CreatedAt time.Time UpdatedAt time.Time Status RoomStatus `gorm:"not null;default:2"` Name string `gorm:"not null;uniqueIndex"` Settings RoomSettings `gorm:"embedded;embeddedPrefix:settings_"` CreatorID string `gorm:"index"` HashedPassword []byte GroupUserRelations []RoomUserRelation `gorm:"foreignKey:RoomID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"` Movies []Movie `gorm:"foreignKey:RoomID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"` }
func (*Room) CheckPassword ¶
func (*Room) NeedPassword ¶
type RoomSettings ¶
type RoomSettings struct { Hidden bool `json:"hidden"` CanCreateMovie bool `gorm:"default:true" json:"canCreateMovie"` CanEditCurrent bool `gorm:"default:true" json:"canEditCurrent"` CanSendChat bool `gorm:"default:true" json:"canSendChat"` DisableJoinNewUser bool `gorm:"default:false" json:"disableJoinNewUser"` JoinNeedReview bool `gorm:"default:false" json:"joinNeedReview"` UserDefaultPermissions RoomUserPermission `json:"userDefaultPermissions"` }
type RoomStatus ¶
type RoomStatus uint64
const ( RoomStatusBanned RoomStatus = 1 RoomStatusPending RoomStatus = 2 RoomStatusActive RoomStatus = 3 )
func (RoomStatus) String ¶
func (r RoomStatus) String() string
type RoomUserPermission ¶
type RoomUserPermission uint64
const ( PermissionAll RoomUserPermission = 0xffffffff PermissionEditRoom RoomUserPermission = 1 << iota PermissionEditUser PermissionCreateMovie PermissionEditCurrent PermissionSendChat )
func (RoomUserPermission) Has ¶
func (p RoomUserPermission) Has(permission RoomUserPermission) bool
type RoomUserRelation ¶
type RoomUserRelation struct { CreatedAt time.Time UpdatedAt time.Time UserID string `gorm:"not null;primarykey"` RoomID string `gorm:"not null;primarykey"` Status RoomUserStatus `gorm:"not null;default:2"` Permissions RoomUserPermission }
func (*RoomUserRelation) HasPermission ¶
func (r *RoomUserRelation) HasPermission(permission RoomUserPermission) bool
type RoomUserStatus ¶
type RoomUserStatus uint64
const ( RoomUserStatusBanned RoomUserStatus = iota + 1 RoomUserStatusPending RoomUserStatusActive )
func (RoomUserStatus) String ¶
func (r RoomUserStatus) String() string
type Setting ¶
type Setting struct { Name string `gorm:"primaryKey"` Value string Type SettingType `gorm:"not null;default:string"` Group SettingGroup `gorm:"not null"` }
type SettingGroup ¶
type SettingGroup string
const ( SettingGroupRoom SettingGroup = "room" SettingGroupUser SettingGroup = "user" SettingGroupProxy SettingGroup = "proxy" SettingGroupRtmp SettingGroup = "rtmp" )
func (SettingGroup) String ¶
func (s SettingGroup) String() string
type SettingType ¶
type SettingType string
const ( SettingTypeBool SettingType = "bool" SettingTypeInt64 SettingType = "int64" SettingTypeFloat64 SettingType = "float64" SettingTypeString SettingType = "string" )
type StreamingVendor ¶
type StreamingVendor string
const (
StreamingVendorBilibili StreamingVendor = "bilibili"
)
type StreamingVendorInfo ¶
type StreamingVendorInfo struct { UserID string `gorm:"not null;primarykey"` Vendor StreamingVendor `gorm:"not null;primarykey"` CreatedAt time.Time UpdatedAt time.Time VendorToken }
type User ¶
type User struct { ID string `gorm:"primaryKey;type:varchar(32)" json:"id"` CreatedAt time.Time UpdatedAt time.Time Providers []UserProvider `gorm:"foreignKey:UserID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"` Username string `gorm:"not null;uniqueIndex"` Role Role `gorm:"not null;default:2"` RoomUserRelations []RoomUserRelation `gorm:"foreignKey:UserID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"` Rooms []Room `gorm:"foreignKey:CreatorID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"` Movies []Movie `gorm:"foreignKey:CreatorID;constraint:OnUpdate:CASCADE,OnDelete:SET NULL"` StreamingVendorInfos []StreamingVendorInfo `gorm:"foreignKey:UserID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"` }
type UserProvider ¶
type VendorInfo ¶
type VendorInfo struct { Vendor StreamingVendor `json:"vendor"` Bilibili *BilibiliVendorInfo `gorm:"embedded;embeddedPrefix:bilibili_" json:"bilibili,omitempty"` }
type VendorToken ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.