utils

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2021 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConnectionURLBuilder

func ConnectionURLBuilder(n string) (string, error)

ConnectionURLBuilder func for building URL connection.

func GenerateFileName

func GenerateFileName(userID string) (string, error)

GenerateFileName func for generate name for uploaded file.

func GetFileSize

func GetFileSize(pathToFile string) (int64, error)

GetFileSize func for getting the file size.

func GetLocalFileInfo

func GetLocalFileInfo(pathToFile, fileType string) (*models.LocalFileInfo, error)

GetLocalFileInfo func for get local file's info (Content-Type, extension, size, etc).

func NewValidator

func NewValidator() *validator.Validate

NewValidator func for create a new validator for model fields.

func StartServer

func StartServer(a *fiber.App)

StartServer func for starting a simple server.

func StartServerWithGracefulShutdown

func StartServerWithGracefulShutdown(a *fiber.App)

StartServerWithGracefulShutdown function for starting server with a graceful shutdown.

func ValidatorErrors

func ValidatorErrors(err error) map[string]string

ValidatorErrors func for show validation errors for each invalid fields.

Types

type TokenMetaData

type TokenMetaData struct {
	UserID uuid.UUID
	Expire int64
}

TokenMetadata struct to describe metadata in JWT.

func ExtractTokenMetaData

func ExtractTokenMetaData(c *fiber.Ctx) (*TokenMetaData, error)

ExtractTokenMetaData func to extract metadata from JWT.

func TokenValidateExpireTime

func TokenValidateExpireTime(ctx *fiber.Ctx) (*TokenMetaData, error)

TokenValidateExpireTime func for validating given JWT token with expire time.

Jump to

Keyboard shortcuts

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