util

package
v0.0.0-...-18492a3 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddRoutePrefix

func AddRoutePrefix(prefix string, h http.HandlerFunc) http.Handler

AddRoutePrefix adds prefix to request and handle with h handler

func Base58UID

func Base58UID(n int) []byte

Base58UID random base58 identifier

func ExecTimeLogger

func ExecTimeLogger(msg string) func()

ExecTimeLogger returns function intented to be used in defer to log execution time

func GetUID

func GetUID() []byte

GetUID returns new unique id (xid)

func WalkFiles

func WalkFiles(hfs fs.FS, prefixPath string, walker FileWalkerFunc) error

WalkFiles is wrapper around fs.Walk that walks only files excluding directories and handles file one errors

Types

type FileWalkerFunc

type FileWalkerFunc func(data []byte, filePath string) error

FileWalkerFunc walker function for WalkFiles

type SignedUIDGenerator

type SignedUIDGenerator struct {
	// contains filtered or unexported fields
}

func NewSignedUIDGenerator

func NewSignedUIDGenerator(secret []byte) *SignedUIDGenerator

func (*SignedUIDGenerator) GetUID

func (s *SignedUIDGenerator) GetUID(n int) []byte

func (*SignedUIDGenerator) Validate

func (s *SignedUIDGenerator) Validate(data []byte) bool

Jump to

Keyboard shortcuts

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