util

package
v0.1.12 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DateFormat = "2006-01-02"
View Source
var TimestampFormat = "2006-01-02 15:04:05"

Functions

func BoolToString

func BoolToString(b bool) string

func ContainsAny

func ContainsAny(s string, strs ...string) bool

func ContainsAnyIgnoreCase

func ContainsAnyIgnoreCase(s string, strs ...string) bool

func DeduplicateIds

func DeduplicateIds(ids string) string

func EqualsAnyIgnoreCase

func EqualsAnyIgnoreCase(s string, strs ...string) bool

func ExtractEmails

func ExtractEmails(text string) []string

func FileExists

func FileExists(filePath string) bool

func FormatDate

func FormatDate(tm time.Time) string

func FormatMail

func FormatMail(name, mail string) string

func FormatTime

func FormatTime(tm time.Time) string

func GetCachePath

func GetCachePath(rootPath, filename string) string

func IsMatchPath

func IsMatchPath(path, smath string) bool

func MD5

func MD5(data []byte) string

func MD5Str

func MD5Str(data string) string

func Millisecond

func Millisecond() uint32

func ParseMail added in v0.1.10

func ParseMail(recipient string) (name string, mail string, err error)

func RemoveDuplicates

func RemoveDuplicates(nums []string) []string

func ReplaceAllRegex

func ReplaceAllRegex(path, regex, math string) string

func SplitAndDeduplicate added in v0.1.12

func SplitAndDeduplicate(text, sep string) []string

func SplitPath

func SplitPath(path string) []string

func StringToUintIds

func StringToUintIds(ids string) []uint

Types

type Config

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

func LoadFile

func LoadFile(fileName string) (*Config, error)

func (*Config) GetBooleanOrDefault

func (cfg *Config) GetBooleanOrDefault(section, name string, defaultValue bool) bool

func (*Config) GetInt

func (cfg *Config) GetInt(section, name string) (int, error)

func (*Config) GetInt64OrDefault

func (cfg *Config) GetInt64OrDefault(section, name string, defaultValue int64) int64

func (*Config) GetIntOrDefault

func (cfg *Config) GetIntOrDefault(section, name string, defaultValue int) int

func (*Config) GetString

func (cfg *Config) GetString(section, name string) string

func (*Config) GetStringOrDefault

func (cfg *Config) GetStringOrDefault(section, name string, defaultValue string) string

func (*Config) Save

func (cfg *Config) Save() error

func (*Config) SetBoolean

func (cfg *Config) SetBoolean(section, key string, value bool) error

func (*Config) SetInt

func (cfg *Config) SetInt(section, key string, value int) error

func (*Config) SetString

func (cfg *Config) SetString(section, key string, value string) error

Jump to

Keyboard shortcuts

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