utils

package
v0.0.0-...-18354f7 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const ItemsPerPage = 30

Variables

This section is empty.

Functions

func AuthId

func AuthId(c *fiber.Ctx) uint

func AuthUser

func AuthUser(c *fiber.Ctx) models.User

func FindFollowId

func FindFollowId(follows []models.Follow, followId uint) uint

func FindUser

func FindUser(users []models.User, userId uint) models.User

func FollowerCount

func FollowerCount(userId uint) int64

func FollowingCount

func FollowingCount(userId uint) int64

func GetOffset

func GetOffset(c *fiber.Ctx) int

func GetUser

func GetUser(uuid string) (models.User, error)

func HasLiked

func HasLiked(userId uint, postId uint, likes []models.Like) bool

func HashCheck

func HashCheck(password, hash string) bool

func HashMake

func HashMake(password string) string

func IsFollowRequested

func IsFollowRequested(userId uint, by uint) bool

func IsFollowed

func IsFollowed(userId uint, by uint) bool

func IsFollower

func IsFollower(userId uint, by uint) bool

func LikeCount

func LikeCount(postId uint) int64

func LikedPosts

func LikedPosts(userId uint, postIds []uint) []models.Like

func MakeAccessToken

func MakeAccessToken(c *fiber.Ctx, user *models.User) error

func MakeCode

func MakeCode() string

func MakePostsResponse

func MakePostsResponse(c *fiber.Ctx, posts []models.Post) error

func MakeToken

func MakeToken() string

func MakeUsersResponse

func MakeUsersResponse(c *fiber.Ctx, users []models.User) error

func PostCount

func PostCount(userId uint) int64

func PostLikes

func PostLikes(postId uint, postLikeCounts []PostLikeCount) uint

func ProcessNotificationResponse

func ProcessNotificationResponse(c *fiber.Ctx, notifications []models.Notification) []resources.NotificationResource

func ProcessPostsResponse

func ProcessPostsResponse(c *fiber.Ctx, posts []models.Post) []resources.PostResource

func ProcessProfileResponse

func ProcessProfileResponse(user models.User) resources.ProfileResource

func ProcessUsersResponse

func ProcessUsersResponse(c *fiber.Ctx, users []models.User) []resources.UserResource

func RandString

func RandString(n int) string

func RandStringCharset

func RandStringCharset(charset string, n int) string

func SendPasswordResetCode

func SendPasswordResetCode(email string, name string, code string)

func TotalPostCount

func TotalPostCount() int64

func TotalUserCount

func TotalUserCount() int64

func UserFollowers

func UserFollowers(userId uint) []models.User

func UserFollowing

func UserFollowing(userId uint) []models.User

func UserPosts

func UserPosts(userId uint) []models.Post

Types

type PostLikeCount

type PostLikeCount struct {
	PostId uint
	Count  uint
}

func LikeCounts

func LikeCounts(postIds []uint) []PostLikeCount

Jump to

Keyboard shortcuts

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