utils

package
v1.4.4-0...-eedc5a8 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddDevPrefix

func AddDevPrefix(name string) string

AddDevPrefix adds dev directory prefix.

func Contains

func Contains[ctype comparable](slice []ctype, value ctype) bool

Contains checks whether value in the slice.

func Eprintf

func Eprintf(quiet, asErr bool, format string, a ...any)

Eprintf prints the message to the stdout and stderr based on inputs

func IsUUID

func IsUUID(value string) bool

IsUUID checks whether value is UUID string.

func ToJSON

func ToJSON(obj interface{}) ([]byte, error)

ToJSON converts any type to JSON

func ToYAML

func ToYAML(i interface{}) ([]byte, error)

ToYAML converts any type to YAML

func TrimDevPrefix

func TrimDevPrefix(name string) string

TrimDevPrefix trims dev directory prefix.

Types

type SafeFile

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

SafeFile is used to write the yaml

func NewSafeFile

func NewSafeFile(filename string) (*SafeFile, error)

NewSafeFile returns new SafeFile

func (*SafeFile) Close

func (safeFile *SafeFile) Close() error

Close after writing to file

func (*SafeFile) Write

func (safeFile *SafeFile) Write(p []byte) (int, error)

Writes writes to the file

type StringSet

type StringSet map[string]struct{}

StringSet is set of strings.

func (StringSet) Equal

func (set StringSet) Equal(set2 StringSet) (found bool)

Equal checks whether given StringSet is same or not.

func (StringSet) Exist

func (set StringSet) Exist(value string) (found bool)

Exist checks whether given value is in the set or not.

func (StringSet) Set

func (set StringSet) Set(value string)

Set sets a string value.

func (StringSet) ToSlice

func (set StringSet) ToSlice() (values []string)

ToSlice converts set to slice of strings.

Jump to

Keyboard shortcuts

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