Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ChatroomList = []*Chatroom{ &Chatroom{ ChatroomRequest: ChatroomRequest{ Name: "chatroom01", DisplayName: "Display name test1", }, ID: 1, }, &Chatroom{ ChatroomRequest: ChatroomRequest{ Name: "chatroom02", DisplayName: "Display name test2", }, ID: 2, }, }
var ErrChatroomNotFound = fmt.Errorf("ChatroomRequest not found")
ErrChatroomNotFound is an error raised when a ChatroomRequest can not be found in the database
Functions ¶
This section is empty.
Types ¶
type Chatroom ¶
type Chatroom struct {
// the id for the chatroom
//
// required: false
// min: 1
ID int `json:"id"`
ChatroomRequest
CreatedAt time.Time `json:"created_at,omitempty"`
UpdatedAt time.Time `json:"updated_at,omitempty"`
CreatorUserID string `json:"created_userid,omitempty"`
}
ChatroomRequest represents a muc chatroom response. swagger:model
type ChatroomRequest ¶
type ChatroomRequest struct {
Enabled bool `json:"enabled"`
// the name for the chatroom
//
// required: true
Name string `json:"name"`
// the chatroom display_name
//
// required: true
DisplayName string `json:"display_name"`
// the chatroom type
//
// required: true
Type string `json:"type"`
Purpose string `json:"purpose,omitempty"`
Header string `json:"header,omitempty"`
}
ChatroomRequest represents a muc chatroom request. swagger:model
type ChatroomsDB ¶
type ChatroomsDB struct {
// contains filtered or unexported fields
}
func NewChatroomsDB ¶
func NewChatroomsDB(l hclog.Logger) *ChatroomsDB
func (*ChatroomsDB) AddChatroom ¶
func (p *ChatroomsDB) AddChatroom(pr *Chatroom)
AddChatroom adds a new ChatroomRequest to the database
func (*ChatroomsDB) DeleteChatroom ¶
func (p *ChatroomsDB) DeleteChatroom(id int) error
DeleteChatroom deletes a ChatroomRequest from the database
func (*ChatroomsDB) GetChatroomByID ¶
func (p *ChatroomsDB) GetChatroomByID(id int) (*Chatroom, error)
GetChatroomByID returns a single ChatroomRequest which matches the id from the database. If a ChatroomRequest is not found this function returns a ChatroomNotFound error
func (*ChatroomsDB) GetChatrooms ¶
func (p *ChatroomsDB) GetChatrooms() (Chatrooms, error)
GetChatrooms returns all Chatrooms from the database
func (*ChatroomsDB) UpdateChatroom ¶
func (p *ChatroomsDB) UpdateChatroom(pr Chatroom) error
UpdateChatroom replaces a ChatroomRequest in the database with the given item. If a ChatroomRequest with the given id does not exist in the database this function returns a ChatroomNotFound error