data

package
v0.0.0-...-b7d3607 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2021 License: MIT Imports: 4 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 ChatroomMemberList = []*ChatroomMember{
	&ChatroomMember{
		ChatroomMemberRequest: ChatroomMemberRequest{
			UserID: "1",
			Role:   "speaker",
		},
		ChatroomID:   "1",
		UpdatedAt:    time.Now(),
		LastViewedAt: time.Now(),
	},
	&ChatroomMember{
		ChatroomMemberRequest: ChatroomMemberRequest{
			UserID: "2",
			Role:   "listener",
		},
		ChatroomID:   "2",
		UpdatedAt:    time.Now(),
		LastViewedAt: time.Now(),
	},
}
View Source
var ErrChatroomMemberNotFound = fmt.Errorf("ChatroomMemberRequest not found")

ErrChatroomMemberNotFound is an error raised when a ChatroomMemberRequest can not be found in the database

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 string `json:"id"`
	ChatroomRequest
	CreatorUserID string    `json:"created_userid,omitempty"`
	CreatedAt     time.Time `json:"created_at,omitempty"`
	UpdatedAt     time.Time `json:"updated_at,omitempty"`
	DeletedAt     time.Time `json:"deleted_at,omitempty"`
	LastPostAt    time.Time `json:"lastpost_at,omitempty"`
}

ChatroomRequest represents a muc chatroom response. swagger:model

type ChatroomMember

type ChatroomMember struct {
	// the id for the chatroom
	//
	// required: false
	// min: 1
	ChatroomID string `json:"chatroom_id"`
	ChatroomMemberRequest
	UpdatedAt    time.Time `json:"updated_at,omitempty"`
	LastViewedAt time.Time `json:"lastviewed_at,omitempty"`
}

ChatroomMemberRequest represents a muc chatroom response. swagger:model

type ChatroomMemberLastViewedAt

type ChatroomMemberLastViewedAt struct {
	LastViewedAt time.Time `json:"lastviewed_at,omitempty"`
}

ChatroomMemberLastViewedAt represents a LastViewedAt update body swagger:model

type ChatroomMemberRequest

type ChatroomMemberRequest struct {
	// the id for the user
	//
	// required: true
	UserID string `json:"user_id"`

	// the user role in the chatroom
	//
	// required: failse
	Role string `json:"role"`
}

ChatroomMemberRequest represents a muc chatroom request. swagger:model

type ChatroomMembers

type ChatroomMembers []*ChatroomMember

ChatroomMembers defines a slice of ChatroomMemberRequest

type ChatroomMembersDB

type ChatroomMembersDB struct {
	// contains filtered or unexported fields
}

func NewChatroomMembersDB

func NewChatroomMembersDB(l hclog.Logger) *ChatroomMembersDB

func (*ChatroomMembersDB) AddChatroomMember

func (p *ChatroomMembersDB) AddChatroomMember(pr *ChatroomMember)

AddChatroomMember adds a new ChatroomMemberRequest to the database

func (*ChatroomMembersDB) DeleteChatroomMember

func (p *ChatroomMembersDB) DeleteChatroomMember(chatroonID string, userID string) error

DeleteChatroomMember deletes a ChatroomMemberRequest from the database

func (*ChatroomMembersDB) GetChatroomMembers

func (p *ChatroomMembersDB) GetChatroomMembers() (ChatroomMembers, error)

GetChatroomMembers returns all ChatroomMembers from the database

func (*ChatroomMembersDB) GetChatroomMembersByChatroomID

func (p *ChatroomMembersDB) GetChatroomMembersByChatroomID(chatroomID string) (ChatroomMembers, error)

GetChatroomMembersByChatroomID returns a single ChatroomMemberRequest which matches the id from the database. If a ChatroomMemberRequest is not found this function returns a ChatroomMemberNotFound error

func (*ChatroomMembersDB) GetChatroomMembersByUserID

func (p *ChatroomMembersDB) GetChatroomMembersByUserID(userID string) (ChatroomMembers, error)

GetChatroomMembersByUserID returns a single ChatroomMemberRequest which matches the id from the database. If a ChatroomMemberRequest is not found this function returns a ChatroomMemberNotFound error

func (*ChatroomMembersDB) UpdateChatroomMember

func (p *ChatroomMembersDB) UpdateChatroomMember(pr ChatroomMember) error

UpdateChatroomMember replaces a ChatroomMemberRequest in the database with the given item. If a ChatroomMemberRequest with the given id does not exist in the database this function returns a ChatroomMemberNotFound error

func (*ChatroomMembersDB) UpdateLastViewedAt

func (p *ChatroomMembersDB) UpdateLastViewedAt(chatroomid string, userid string, lastviewedat time.Time) (*ChatroomMember, error)

UpdateChatroomMember replaces a ChatroomMemberRequest in the database with the given item. If a ChatroomMemberRequest with the given id does not exist in the database this function returns a ChatroomMemberNotFound error

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 string) error

DeleteChatroom deletes a ChatroomRequest from the database

func (*ChatroomsDB) GetChatroomByID

func (p *ChatroomsDB) GetChatroomByID(id string) (*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