helper

package
v0.0.0-...-d4b65f6 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package helper provides common helper functions for handling HTTP requests and errors.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClientError

func ClientError(w http.ResponseWriter, status int)

ClientError logs a client error and responds with the specified HTTP status code.

func CorrectPunctuationsSpaces

func CorrectPunctuationsSpaces(input string) string

CorrectPunctuationsSpaces takes an input string and adds spaces around punctuation marks based on the specified rules duscribed by inner function applyPunctuationRules. Punctuation marks are placed close to the previous word and separated by a space from the following content. Exceptions include groups of punctuation like '...' or '!?'.

func NewHelper

func NewHelper(a *config.AppConfig)

NewHelper Set the config to the helper

func ServerError

func ServerError(w http.ResponseWriter, err error)

ServerError logs a server error, including the error message and stack trace, and responds with a 500 Internal Server Error status code

Types

This section is empty.

Jump to

Keyboard shortcuts

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