util

package
v1.46.0 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ReWhiteSpace     *regexp.Regexp
	ReFieldWhiteList *regexp.Regexp
)

Functions

func FileExist

func FileExist(path string) bool

func FilterField added in v1.21.0

func FilterField(field string) bool

func GenerateTwoUniqueRandomStrings added in v1.3.0

func GenerateTwoUniqueRandomStrings() (string, string, error)

func GetClientIp added in v1.18.0

func GetClientIp(r *http.Request) string

func GetCurrentTime added in v1.3.0

func GetCurrentTime() string

func GetHostname

func GetHostname() string

func GetIdFromOwnerAndName

func GetIdFromOwnerAndName(owner string, name string) string

func GetOwnerAndNameFromId

func GetOwnerAndNameFromId(id string) (string, string)

func GetOwnerAndNameFromId3

func GetOwnerAndNameFromId3(id string) (string, string, string)

func GetOwnerAndNameFromId3New

func GetOwnerAndNameFromId3New(id string) (string, string, string)

func IndexAt

func IndexAt(s, sep string, n int) int

func JsonToStruct

func JsonToStruct(data string, v interface{}) error

func ListFiles

func ListFiles(path string) []string

func ParseFloat

func ParseFloat(s string) float64

func ParseInt

func ParseInt(s string) int

func ParseIntWithError

func ParseIntWithError(s string) (int, error)

func ReadBytesFromPath

func ReadBytesFromPath(path string) []byte

func ReadStringFromPath

func ReadStringFromPath(path string) string

func SnakeString added in v1.21.0

func SnakeString(s string) string

func StructToJson

func StructToJson(v interface{}) string

func StructToJsonNoIndent added in v1.3.0

func StructToJsonNoIndent(v interface{}) string

func WriteBytesToPath

func WriteBytesToPath(b []byte, path string)

func WriteStringToPath

func WriteStringToPath(s string, path string)

Types

type Stack added in v1.33.0

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

Stack is a stack data structure implemented using a slice

func NewStack added in v1.33.0

func NewStack() *Stack

NewStack creates a new stack

func (*Stack) IsEmpty added in v1.33.0

func (s *Stack) IsEmpty() bool

IsEmpty checks if the stack is empty

func (*Stack) Peek added in v1.33.0

func (s *Stack) Peek() interface{}

Peek returns the last item from the stack without removing it

func (*Stack) Pop added in v1.33.0

func (s *Stack) Pop() (interface{}, bool)

Pop removes and returns the last item from the stack

func (*Stack) Push added in v1.33.0

func (s *Stack) Push(item interface{})

Push adds an item to the stack

func (*Stack) Size added in v1.33.0

func (s *Stack) Size() int

Size returns the number of items in the stack

Jump to

Keyboard shortcuts

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