util

package
v0.0.0-...-a7d8e7d Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

SPDX-FileCopyrightText: 2020 Santiago De la Cruz <delacruzsantiago12@gmail.com> SPDX-License-Identifier: BSD-3-Clause

Code below is a modified version of https://github.com/xhit/go-str2duration: only addition is support year intervals.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrWrap

func ErrWrap[T any](def T) func(T, error) T

func IsDir

func IsDir(path string) bool

func IsValidHTML

func IsValidHTML(body []byte) bool

func ParseDuration

func ParseDuration(s string) (time.Duration, error)

ParseDuration parses a duration string. A duration string is a possibly signed sequence of decimal numbers, each with optional fraction and a unit suffix, such as "300ms", "-1.5h" or "2h45m". Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h", "d", "w".

func ParseQueryString

func ParseQueryString(queryStrings []byte) map[string]string

func RegexesAnyMatch

func RegexesAnyMatch(payload string, regexes ...string) bool

func RegexesMatch

func RegexesMatch(payload string, regexes ...string) bool

func StringSliceContains

func StringSliceContains(slice []string, item string) bool

func StringSliceDistinct

func StringSliceDistinct(slice []string) (distinct []string)

func StringSlicesEqual

func StringSlicesEqual(a, b []string) bool

Types

type ZStdLogger

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

func NewZStdLogger

func NewZStdLogger(fd ...io.Writer) ZStdLogger

func (ZStdLogger) Fatal

func (l ZStdLogger) Fatal(args ...interface{})

func (ZStdLogger) Fatalf

func (l ZStdLogger) Fatalf(format string, args ...interface{})

func (ZStdLogger) Fatalln

func (l ZStdLogger) Fatalln(args ...interface{})

func (ZStdLogger) Print

func (l ZStdLogger) Print(args ...interface{})

func (ZStdLogger) Printf

func (l ZStdLogger) Printf(format string, args ...interface{})

func (ZStdLogger) Println

func (l ZStdLogger) Println(args ...interface{})

Jump to

Keyboard shortcuts

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