utils

package
v0.1.18 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2025 License: Apache-2.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains added in v0.1.2

func Contains(a []string, x string) bool

Contains tells whether a contains x.

func DirExists

func DirExists(path string) bool

DirExists checks if a directory exists

func EnsureDir

func EnsureDir(path string) error

EnsureDir ensures a directory exists

func ExtractDomain added in v0.1.5

func ExtractDomain(url string) string

ExtractDomain extracts the domain from a URL string.

func FileExists

func FileExists(path string) bool

FileExists checks if a file exists

func Find added in v0.1.2

func Find(a []string, x string) int

Find returns the smallest index i at which x == a[i], or len(a) if there is no such index.

func FindID added in v0.1.2

func FindID(a []string, x string) int

func FirstLower added in v0.1.2

func FirstLower(s string) string

FirstLower returns a copy of the string s with its first letter lowercased.

func FirstUpper added in v0.1.2

func FirstUpper(s string) string

FirstUpper returns a copy of the string s with its first letter capitalized.

func GetHost

func GetHost(conf *config.Config, space string, ports ...int) string

GetHost constructs the URL based on the given space and config, with an optional port.

func GetPlatform

func GetPlatform() string

func GetPlatformExt

func GetPlatformExt() string

GetPlatformExt returns the platform-specific extension

func IsValidDomain added in v0.1.5

func IsValidDomain(domain string) bool

IsValidDomain checks if a string is a valid domain.

func IsValidURL added in v0.1.5

func IsValidURL(url string) bool

IsValidURL checks if a string is a valid URL.

func PathExists

func PathExists(path string) (bool, error)

PathExists checks if a file or directory exists

func RemoveDuplicates added in v0.1.2

func RemoveDuplicates(a []string) []string

RemoveDuplicates removes duplicate elements from a.

func ValidateName

func ValidateName(name string) bool

ValidateName validates a name

func WriteTemplateFile

func WriteTemplateFile(path, content string, data any) error

WriteTemplateFile writes a template file with provided data

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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