Documentation ¶
Overview ¶
* MIT License * * Copyright (c) 2022 The hvxahv Authors. *
Index ¶
- Constants
- func Run() error
- type Administrates
- func (adm *Administrates) AddAdministrator(addedID uint) error
- func (adm *Administrates) AddAdministratorOwner() error
- func (adm *Administrates) DeleteAdministrators() error
- func (adm *Administrates) ExitAdministrator() error
- func (adm *Administrates) GetAdministrators() ([]*Administrates, error)
- func (adm *Administrates) IsAdministrator() bool
- func (adm *Administrates) IsChannelOwner() bool
- func (adm *Administrates) RemoveAdministrator(removedId uint) error
- type Administrator
- type Broadcast
- type Broadcasts
- type Channel
- type Channels
- type Subscribe
- type Subscribes
- func (sub *Subscribes) AddSubscriber(adminId uint) error
- func (sub *Subscribes) GetSubscribers(adminId uint) ([]*Subscribes, error)
- func (sub *Subscribes) IsSubscriber() (bool, error)
- func (sub *Subscribes) RemoveSubscriber(adminId uint) error
- func (sub *Subscribes) Subscription() error
- func (sub *Subscribes) Unsubscribe() error
Constants ¶
View Source
const ( // ErrNotFound is returned when a channel is not found. ErrNotFound = "CHANNEL_NOT_FOUND" ChannelsTable = "channels" )
View Source
const (
// AdministrateTable is the table name for the administrates table.
AdministrateTable = "administrates"
)
View Source
const (
BroadcastsTableName = "broadcasts"
)
View Source
const (
SubscribesTable = "subscribes"
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Administrates ¶
type Administrates struct { gorm.Model ChannelId uint `gorm:"primaryKey;channel_id"` // AdminId admin actor id. AdminId uint `gorm:"primaryKey;admin_id"` IsOwner bool `gorm:"type:boolean;is_owner"` }
func NewAdministratesAdd ¶
func NewAdministratesAdd(channelId, adminId uint) *Administrates
func NewAdministratesAddOwner ¶
func NewAdministratesAddOwner(channelId, adminId uint) *Administrates
func NewAdministratesPermission ¶
func NewAdministratesPermission(channelId, adminId uint) *Administrates
func (*Administrates) AddAdministrator ¶
func (adm *Administrates) AddAdministrator(addedID uint) error
AddAdministrator adds an administrator to a channel. Only administrators can add administrators.
func (*Administrates) AddAdministratorOwner ¶
func (adm *Administrates) AddAdministratorOwner() error
AddAdministratorOwner Add the channel owner to the Admin table.
func (*Administrates) DeleteAdministrators ¶
func (adm *Administrates) DeleteAdministrators() error
DeleteAdministrators ...
func (*Administrates) ExitAdministrator ¶
func (adm *Administrates) ExitAdministrator() error
func (*Administrates) GetAdministrators ¶
func (adm *Administrates) GetAdministrators() ([]*Administrates, error)
GetAdministrators ... Returns all administrators of a channel. Check permissions. Only administrator can view the list of administrators who manage the channel.
func (*Administrates) IsAdministrator ¶
func (adm *Administrates) IsAdministrator() bool
func (*Administrates) IsChannelOwner ¶
func (adm *Administrates) IsChannelOwner() bool
func (*Administrates) RemoveAdministrator ¶
func (adm *Administrates) RemoveAdministrator(removedId uint) error
type Administrator ¶
type Broadcast ¶
type Broadcast interface { Create() error GetBroadcasts() ([]*Broadcasts, error) // Get all broadcasts. Delete() error }
type Broadcasts ¶
type Broadcasts struct { gorm.Model ChannelId uint `gorm:"primaryKey;type:bigint;channel_id"` // ActorId in the AdminId Actor data table, which identifies the creator of the Broadcast. // Must be the administrator of the channel. AdminId uint `gorm:"type:bigint;admin_id"` CID string `gorm:"type:text;cid"` }
func NewBroadcasts ¶
func NewBroadcasts(channelId, adminId uint, cid string) *Broadcasts
func NewBroadcastsChannelId ¶
func NewBroadcastsChannelId(channelId uint) *Broadcasts
func NewBroadcastsDelete ¶
func NewBroadcastsDelete(id, channelId, adminId uint) *Broadcasts
func (*Broadcasts) Create ¶
func (b *Broadcasts) Create() error
func (*Broadcasts) Delete ¶
func (b *Broadcasts) Delete() error
func (*Broadcasts) GetBroadcasts ¶
func (b *Broadcasts) GetBroadcasts() ([]*Broadcasts, error)
type Channel ¶
type Channel interface { // CreateChannel is used to create a channel. CreateChannel() error // GetChannels is used to retrieve all channels for a creator. GetChannels() ([]*Channels, error) // DeleteChannel is used to delete a channel. DeleteChannel() error // DeleteChannels is used to delete all channels. DeleteChannels() error GetPrivateKeyByActorId() (*Channels, error) }
type Channels ¶
type Channels struct { gorm.Model // ActorId Since the Actor of ActivityPub is to be used as the data source of the Channel, // the ActorId needs to be saved here. ActorId uint `gorm:"primaryKey;type:bigint;actor_id"` // CreatorId Store the creator's ActorID in Channel as the owner of the channel. CreatorId uint `gorm:"primaryKey;type:bigint;creator_id"` // The current Channel design differs from the account design in that there is no privacy in the Channel. // So the key will be generated by the server and stored in the database. // The public key will be saved in the Actor table when the actor is created // And the private key will be saved in the Channel. PrivateKey string `gorm:"private_key;type:text;private_key"` }
func NewChannelActorId ¶
func NewChannels ¶
NewChannels channels constructor. The channel can be created by this constructor.
func NewChannelsCreatorId ¶
NewChannelsCreatorId Constructing the creator ID (actorId).
func NewChannelsDelete ¶
NewChannelsDelete Delete the constructor of the method.
func (*Channels) CreateChannel ¶
func (*Channels) DeleteChannel ¶
func (*Channels) DeleteChannels ¶
func (*Channels) GetChannels ¶
func (*Channels) GetPrivateKeyByActorId ¶
type Subscribes ¶
type Subscribes struct { gorm.Model ChannelId uint `gorm:"primaryKey;channel_id"` SubscriberId uint `gorm:"primaryKey;subscriber_id"` }
func NewSubscribe ¶
func NewSubscribe(channelId, subscriberId uint) *Subscribes
func NewSubscriberChannelId ¶
func NewSubscriberChannelId(channelId uint) *Subscribes
func (*Subscribes) AddSubscriber ¶
func (sub *Subscribes) AddSubscriber(adminId uint) error
func (*Subscribes) GetSubscribers ¶
func (sub *Subscribes) GetSubscribers(adminId uint) ([]*Subscribes, error)
func (*Subscribes) IsSubscriber ¶
func (sub *Subscribes) IsSubscriber() (bool, error)
func (*Subscribes) RemoveSubscriber ¶
func (sub *Subscribes) RemoveSubscriber(adminId uint) error
func (*Subscribes) Subscription ¶
func (sub *Subscribes) Subscription() error
func (*Subscribes) Unsubscribe ¶
func (sub *Subscribes) Unsubscribe() error
Click to show internal directories.
Click to hide internal directories.