data

package
v0.0.0-...-224a2b7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 4, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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,
	},
}
View Source
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 Chatrooms

type Chatrooms []*Chatroom

Chatrooms defines a slice of ChatroomRequest

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL