Documentation
¶
Index ¶
- Variables
- func AddUserInRoom(token string, userId int) error
- func CreateMessage(userId int, message string, roomId int) error
- func CreateRoom(userId int, name string, token string) error
- func CreateUser(name, password string) error
- func InitDB() error
- func IsUserInRoom(roomId, userId int) error
- type Message
- type MessageWithUser
- type Room
- type RoomNotFound
- type User
- type UserNotFound
Constants ¶
This section is empty.
Variables ¶
View Source
var Db *sql.DB
Functions ¶
func AddUserInRoom ¶
func CreateMessage ¶
NOTE: -1 means public room
func CreateUser ¶
func IsUserInRoom ¶
Types ¶
type MessageWithUser ¶
type MessageWithUser struct {
Id int `json:"id"`
Username string `json:"username"`
UserId int `json:"user_id"`
Message string `json:"message"`
CreatedAt string `json:"created_at"`
}
func GetRoomMessagesInRoom ¶
func GetRoomMessagesInRoom(roomId int) ([]MessageWithUser, error)
type Room ¶
func FindRoomByToken ¶
type RoomNotFound ¶
type RoomNotFound struct{}
func (*RoomNotFound) Error ¶
func (*RoomNotFound) Error() string
type User ¶
type User struct {
Id string `json:"id"`
Name string `json:"name"`
Password string `json:"password"`
CreatedAt string `json:"created_at"`
}
func FindUserById ¶
func FindUserByName ¶
type UserNotFound ¶
type UserNotFound struct{}
func (*UserNotFound) Error ¶
func (*UserNotFound) Error() string
Click to show internal directories.
Click to hide internal directories.