util

package
v0.0.0-...-d02003c Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EmptyError = errors.New("Emtpy value")
View Source
var InternalError = errors.New("Internal error")
View Source
var InvalidTokenError = errors.New("Invalid token")
View Source
var PermissionDeniedError = errors.New("Permission denied")

Functions

func ErrorResponse

func ErrorResponse(w http.ResponseWriter, code int, message string)

func GetIP

func GetIP(r *http.Request) string

GetIP gets a requests IP address by reading off the forwarded-for header (for proxies) and falls back to use the remote address.

func Hash

func Hash(s string) uint64

func JsonResponse

func JsonResponse(w http.ResponseWriter, code int, payload interface{})

func OkOrDie

func OkOrDie(err error)

func ValidUrl

func ValidUrl(raw string) bool

Types

type AlreadyExistsError

type AlreadyExistsError string

func (AlreadyExistsError) Error

func (e AlreadyExistsError) Error() string

type InvalidValueError

type InvalidValueError string

func (InvalidValueError) Error

func (e InvalidValueError) Error() string

type NoSuchKeyError

type NoSuchKeyError string

func (NoSuchKeyError) Error

func (e NoSuchKeyError) Error() string

type VersionMismatchError

type VersionMismatchError struct {
	Expected int
	Actual   int
}

func (VersionMismatchError) Error

func (e VersionMismatchError) Error() string

Jump to

Keyboard shortcuts

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