services

package
v0.0.0-...-0dbe543 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DB *mongo.Database
)
View Source
var (
	RedisClient *redis.Client
)

Functions

func ConnectDB

func ConnectDB()

func ConnectRedis

func ConnectRedis()

ConnectRedis initializes the Redis client.

func DeleteToken

func DeleteToken(token string) error

DeleteToken deletes a token from Redis.

func DisconnectDB

func DisconnectDB()

func GetToken

func GetToken(token string) (bool, error)

GetToken checks if a token exists in Redis.

func SendResponse

func SendResponse(ctx echo.Context, statusCode int, message string, details ...interface{}) error

SendResponse sends an API response with the given status code, status, message, and optional data or error details

func SetToken

func SetToken(token string, expiration time.Duration) error

SetToken sets a token with expiration in Redis.

Types

type APIResponse

type APIResponse struct {
	Status  string      `json:"status"`
	Message string      `json:"message"`
	Data    interface{} `json:"data,omitempty"`
	Error   interface{} `json:"error,omitempty"`
}

APIResponse represents a generic API response

Jump to

Keyboard shortcuts

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