util

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2023 License: MIT Imports: 5 Imported by: 7 modules, 6 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package util provides a set of common functions

Package util provides utilities related to randomization.

Index

Constants

View Source
const (
	ContentType       = "Content-Type"
	MultiPartFormData = "multipart/form-data"
	Form              = "application/x-www-form-urlencoded"
)

ContentType is the HTTP header key

Variables

This section is empty.

Functions

func Expand added in v0.0.12

func Expand(text string) (result []string)

Expand the text with brace syntax. Such as: /home/{good,bad} -> [/home/good, /home/bad]

func MakeSureNotNil

func MakeSureNotNil[T any](inter T) T

MakeSureNotNil makes sure the parameter is not nil

func String

func String(n int) string

String generates a random alphanumeric string, without vowels, which is n characters long. This will panic if n is less than zero. How the random string is created: - we generate random int63's - from each int63, we are extracting multiple random letters by bit-shifting and masking - if some index is out of range of alphanums we neglect it (unlikely to happen multiple times in a row)

Types

This section is empty.

Jump to

Keyboard shortcuts

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