db

package
v0.0.0-...-d966f92 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Close

func Close()

func CreateUser

func CreateUser(fullname, username, passwordHash string) error

func CreateUserSession

func CreateUserSession(userId uint64, sessionId string) error

func DeleteFriendRequest

func DeleteFriendRequest(from, to uint64) error

func DeleteFriendship

func DeleteFriendship(userId1, userId2 uint64) error

func DeleteUserSession

func DeleteUserSession(sessionId string) error

func GetConversationsOf

func GetConversationsOf(userId uint64) ([]models.Conversation, error)

func GetFriendRequestorsTo

func GetFriendRequestorsTo(userId uint64) ([]models.User, error)

Returns list of users that have sent request to given user

func GetFriends

func GetFriends(userId uint64) ([]models.User, error)

Returns list of users that are friends to user with given id

func GetFriendshipStatus

func GetFriendshipStatus(userId, otherUserId uint64) (string, error)

Returns status of friendship for two users from first user's point of view. Can give 4 statuses, "friends", "req-sent", "req-received", "unknown". Ex. "req-sent" means first user has sent a request to second.

func GetMessagesAmong

func GetMessagesAmong(userId1, userId2 uint64) ([]models.Message, error)

func GetRecentChatPartners

func GetRecentChatPartners(userId uint64) ([]models.User, error)

func GetSession

func GetSession(sessionId string) (*models.Session, error)

func GetUserById

func GetUserById(id uint64) (*models.User, error)

func GetUserBySessionId

func GetUserBySessionId(sessionId string) (*models.User, error)

func GetUserByUsername

func GetUserByUsername(username string) (*models.User, error)

func IsUsernameTaken

func IsUsernameTaken(username string) (bool, error)

func MustInit

func MustInit()

func RecordFriendRequest

func RecordFriendRequest(from, to uint64) error

func RecordFriendship

func RecordFriendship(userId1, userId2 uint64) error

func RecordMessage

func RecordMessage(senderId, receiverId uint64, text string, timestamp time.Time) (uint64, error)

func SearchUser

func SearchUser(searchType, searchQuery string) ([]models.User, error)

func UpdateOrCreateConversation

func UpdateOrCreateConversation(senderId, receiverId uint64, timestamp time.Time) error

Updates an exsiting conversation's timestamp between two users or creates a new one

func UpdateUser

func UpdateUser(userId uint64, newUser models.User) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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