utils

package
v0.0.0-...-0915ee4 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2017 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AtMost

func AtMost(n, min, max uint64) uint64

AtMost check if n is valid uint64 value between min and max. In that case, it returns "n", otherwise return max

func Gravatar

func Gravatar(email string) *url.URL

Gravatar returns the gravatar url of the given email

func InSlice

func InSlice(value, slice interface{}) bool

InSlice returns true if value is in slice

func ParseTag

func ParseTag(str string) map[string]string

ParseTag parse the string str, that represents a struct tag in his format than returns a map of tags present with their associated values

func ReverseSlice

func ReverseSlice(slice interface{}) interface{}

ReverseSlice reverse slice if slice is of type reflect.Slice or reflrect.Ptr (to silce) panics if slice type is different

func UpperFirst

func UpperFirst(s string) string

UpperFirst returns a copy of the s string, with the first letter capitalized

Types

type StringSet

type StringSet map[string]struct{}

StringSet represents a string set.

func (StringSet) Contains

func (ss StringSet) Contains(str string) (ok bool)

Contains returns true if the string is contained in the set, false otherwise.

func (StringSet) Put

func (ss StringSet) Put(str string)

Put adds the string to the set. Nothing happens if it is already present.

Jump to

Keyboard shortcuts

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