utils

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Base64UrlDecode

func Base64UrlDecode(data string) ([]byte, error)

Base64UrlDecode encodes a byte slice to a base64 string

func Base64UrlEncode

func Base64UrlEncode(data string) string

func CheckEnvVariables

func CheckEnvVariables(variables []string)

Check if the required environment variables exist

func CheckOrganize

func CheckOrganize(data string) (string, bool)

Get the parameters separate by '::'

func IsWebSocket added in v1.2.1

func IsWebSocket(r *http.Request) bool

Check if the request is WebSocket

func LoadEnv

func LoadEnv()

LoadEnv loads the environment variables from .env file

func OutputMessage

func OutputMessage(w interface{}, mode MessageOutputMode, statusCode int, format string, a ...interface{})

OutputMessage provides message output, output to HTTP or log according to mode

Types

type MessageOutputMode

type MessageOutputMode int
const (
	// HTTPResponse means the message will be output as HTTP response
	HTTPResponse MessageOutputMode = iota
	// WebSocketResponse means the message will be output as WebSocket response
	WebSocketResponse
	// LogOutput means the message will be logged
	LogOutput
	// FatalOutput means the message will be logged and the program will be terminated
	FatalOutput
)

Jump to

Keyboard shortcuts

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