ssg

package
v1.1.32 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2023 License: MIT Imports: 14 Imported by: 7

Documentation

Index

Constants

View Source
const (
	COMMAND_PREFIX1 = "!"
	COMMAND_PREFIX2 = "/"
	SUDO_PREFIX1    = ">"
	FLAG_PREFIX     = "--"
)

the prefix values for commands.

View Source
const (
	JA_Str        = "❞\u200d;" // start character (") for string in japanese.
	JA_Equality   = "=\u200d;" // equal character (=) in japanese.
	JA_Ddot       = ":\u200d;" // ddot character (:) in japanese.
	JA_Cama       = "、\u200d;" // cama character (,) in japanese.
	JA_RealStr    = "\uff4e"   // the real str
	JA_BrOpen     = "「\u200d;" // the real str
	JA_BrClose    = "」\u200d;" // the real str
	BACK_Str      = `\"`
	BACK_Flag     = `\--`
	BACK_Equality = `\=`
	BACK_Ddot     = `\:`
	BACK_Cama     = `\,`
	BACK_BrOpen   = `\[`
	BACK_BrClose  = `\]`
)
View Source
const (
	BaseIndex      = 0  // number 0
	BaseOneIndex   = 1  // number 1
	BaseTwoIndex   = 2  // number 2
	BaseThreeIndex = 3  // number 2
	Base4Bit       = 4  // number 8
	Base8Bit       = 8  // number 8
	Base16Bit      = 16 // number 16
	Base32Bit      = 32 // number 32
	Base64Bit      = 64 // number 64
	BaseTimeOut    = 40 // 40 seconds
	BaseTen        = 10 // 10 seconds
)

the base constant values.

View Source
const (
	BaseIndexStr    = "0" // number 0
	BaseOneIndexStr = "1" // number 1
	DotStr          = "." // dot : .
	LineStr         = "-" // line : -
	EMPTY           = ""  //an empty string.
	UNDER           = "_" // an underscope : _
	STR_SIGN        = `"` // the string sign : "
	CHAR_STR        = '"' // the string sign : '"'
)

additional constants which are not actually used in this package, but may be useful in another packages.

View Source
const (
	APP_PORT        = "PORT"
	GET_SLASH       = "/"
	HTTP_ADDRESS    = ":"
	FORMAT_VALUE    = "%v"
	SPACE_VALUE     = " "
	LineEscape      = "\n"
	R_ESCAPE        = "\r"
	SEMICOLON       = ";"
	CAMA            = ","
	ParaOpen        = "("
	ParaClose       = ")"
	NullStr         = "null"
	DoubleQ         = "\""
	SingleQ         = "'"
	DoubleQJ        = "”"
	BracketOpen     = "["
	Bracketclose    = "]"
	Star            = "*"
	BackSlash       = "\\"
	DoubleBackSlash = "\\\\"
	Point           = "."
	AutoStr         = "auto"
	AtSign          = "@"
	EqualStr        = "="
	DdotSign        = ":"
	Yes             = "Yes"
	No              = "No"
	TrueStr         = "True"
	FalseStr        = "False"
	OnStr           = "On"
	OffStr          = "Off"
	LowerYes        = "yes"
	LowerNo         = "no"
	LowerTrueStr    = "true"
	LowerFalseStr   = "false"
	LowerOnStr      = "on"
	LowerOffStr     = "off"
	OrRegexp        = internal.OrRegexp // the or string sign: "|"
)

router config values

View Source
const (
	LineChar         = '-' // line : '-'
	EqualChar        = '=' // equal: '='
	SpaceChar        = ' ' // space: ' '
	DPointChar       = ':' // double point: ':'
	BracketOpenChar  = '[' // bracket open: '['
	BracketcloseChar = ']' // bracket close: ']'
	CamaChar         = ',' // cama: ','
)
View Source
const (
	JA_FLAG       = "〰〰"
	JA_STR        = "❞" // start character (") for string in japanese.
	JA_EQUALITY   = "=" // equal character (=) for string in japanese.
	JA_DDOT       = ":" // equal character (=) for string in japanese.
	BACK_STR      = "\\\""
	BACK_FLAG     = "\\--"
	BACK_EQUALITY = "\\="
	BACK_DDOT     = "\\:"
)
View Source
const (
	LIST_INDEX_NOTFOUND = -1
)

Variables

This section is empty.

Functions

func AppendUnique added in v1.1.31

func AppendUnique[T comparable](slice []T, value ...T) []T

AppendUnique appends the given value to the given slice if it's not already there. WARNING: Performance is not good for large slices.

func AreEqual

func AreEqual(s1, s2 *string) bool

AreEqual will check if two string ptr are equal to each other or not.

func Clone

func Clone[T any](value *T) *T

Clone function will make an exact copy of the given value. It will return nil if the given value is nil, so it's guaranteed to execute without panic. Usage of this function is up to the users, but it's recommended to not use it on large structures, since it will allocate too much memory.

func FixSplit

func FixSplit(myStrings []string) []string

FixSplit will fix the bullshit bug in the Split function (which is not ignoring the spaces between strings).

func FixSplitWhite

func FixSplitWhite(myStrings []string) []string

FixSplit will fix the bullshit bug in the Split function (which is not ignoring the spaces between strings).

func GetPrettyTimeDuration

func GetPrettyTimeDuration(d time.Duration, shorten bool) string

func IsAllLower

func IsAllLower(value string) bool

func IsAllNumber

func IsAllNumber(str string) bool

func IsAllNumbers

func IsAllNumbers(str ...string) bool

func IsAllUpper

func IsAllUpper(value string) bool

func IsEmpty

func IsEmpty(s *string) bool

IsEmpty function will check if the passed-by string value is empty or not.

func IsMixedCase

func IsMixedCase(value string) bool

func IsRuneNumber

func IsRuneNumber(r rune) bool

func MakeSureNum

func MakeSureNum(i, count int) string

MakeSureNum will make sure that when you convert `i` to string, its length be the exact same as `count`. it will append 0 to the left side of the number to do so. for example: MakeSureNum(5, 8) will return "00000005"

func MakeSureNumCustom

func MakeSureNumCustom(i, count int, holder string) string

MakeSureNumCustom will make sure that when you convert `i` to string, its length be the exact same as `count`. it will append 0 to the left side of the number to do so. for example: MakeSureNum(5, 8) will return "00000005"

func ParseConfig

func ParseConfig(value interface{}, filename string) error

func RecoverPanic

func RecoverPanic()

func Split

func Split(s string, separator ...string) []string

func SplitN

func SplitN(s string, n int, separators ...string) []string

func SplitSlice

func SplitSlice(s string, separators []string) []string

func SplitSliceN

func SplitSliceN(s string, separators []string, n int) []string

func SplitSliceNWhite

func SplitSliceNWhite(s string, separators []string, n int) []string

func SplitWhite

func SplitWhite(s string, separator ...string) []string

SplitWhite splits the string with the given separator and will remove the white spaces slices from the results

func Title

func Title(value string) string

func ToArray

func ToArray(strs ...string) []string

func ToBase10

func ToBase10[T rangeValues.Integer](value T) string

func ToBase16

func ToBase16[T rangeValues.Integer](value T) string

func ToBase18

func ToBase18[T rangeValues.Integer](value T) string

func ToBase20

func ToBase20[T rangeValues.Integer](value T) string

func ToBase28

func ToBase28[T rangeValues.Integer](value T) string

func ToBase30

func ToBase30[T rangeValues.Integer](value T) string

func ToBase32

func ToBase32[T rangeValues.Integer](value T) string

func ToBool

func ToBool(str string) bool

func ToInt16

func ToInt16(value string) int16

func ToInt32

func ToInt32(value string) int32

func ToInt64

func ToInt64(value string) int64

func ToInt8

func ToInt8(value string) int8

func ToInteger added in v1.1.30

func ToInteger[T rangeValues.Integer](value string) T

ToInteger converts a specified string value to integer.

func ToStrSlice

func ToStrSlice(qs []QString) []string

func ToValidIntegerString

func ToValidIntegerString(value string) string

func YesOrNo

func YesOrNo(v bool) string

YesOrNo returns yes if v is true, otherwise no.

Types

type AdvancedMap

type AdvancedMap[TKey comparable, TValue any] struct {
	// contains filtered or unexported fields
}

AdvancedMap is a safe map of type TIndex to pointers of type TValue with extra advanced features that you can't find in safe-map types. obviously, because of its extra features, it's slightly slower than other normal safe-map types. this map is completely thread safe and is using internal lock when getting and setting variables.

func NewAdvancedMap

func NewAdvancedMap[TKey comparable, TValue any]() *AdvancedMap[TKey, TValue]

func (*AdvancedMap[TKey, TValue]) Add

func (s *AdvancedMap[TKey, TValue]) Add(key TKey, value *TValue)

func (*AdvancedMap[TKey, TValue]) AddList

func (s *AdvancedMap[TKey, TValue]) AddList(keyGetter func(*TValue) TKey, elements ...TValue)

func (*AdvancedMap[TKey, TValue]) AddPointerList

func (s *AdvancedMap[TKey, TValue]) AddPointerList(keyGetter func(*TValue) TKey, elements ...*TValue)

func (*AdvancedMap[TKey, TValue]) Clear

func (s *AdvancedMap[TKey, TValue]) Clear()

Clear will clear the whole map.

func (*AdvancedMap[TKey, TValue]) Delete

func (s *AdvancedMap[TKey, TValue]) Delete(key TKey)

func (*AdvancedMap[TKey, TValue]) Exists

func (s *AdvancedMap[TKey, TValue]) Exists(key TKey) bool

func (*AdvancedMap[TKey, TValue]) ForEach

func (s *AdvancedMap[TKey, TValue]) ForEach(fn func(TKey, *TValue) bool)

func (*AdvancedMap[TKey, TValue]) Get

func (s *AdvancedMap[TKey, TValue]) Get(key TKey) *TValue

func (*AdvancedMap[TKey, TValue]) GetRandom

func (s *AdvancedMap[TKey, TValue]) GetRandom() *TValue

func (*AdvancedMap[TKey, TValue]) GetRandomKey

func (s *AdvancedMap[TKey, TValue]) GetRandomKey() (key TKey, ok bool)

func (*AdvancedMap[TKey, TValue]) GetRandomValue

func (s *AdvancedMap[TKey, TValue]) GetRandomValue() TValue

func (*AdvancedMap[TKey, TValue]) GetValue

func (s *AdvancedMap[TKey, TValue]) GetValue(key TKey) TValue

func (*AdvancedMap[TKey, TValue]) IsEmpty

func (s *AdvancedMap[TKey, TValue]) IsEmpty() bool

func (*AdvancedMap[TKey, TValue]) IsThreadSafe

func (s *AdvancedMap[TKey, TValue]) IsThreadSafe() bool

func (*AdvancedMap[TKey, TValue]) IsValid

func (s *AdvancedMap[TKey, TValue]) IsValid() bool

func (*AdvancedMap[TKey, TValue]) Length

func (s *AdvancedMap[TKey, TValue]) Length() int

func (*AdvancedMap[TKey, TValue]) Set

func (s *AdvancedMap[TKey, TValue]) Set(key TKey, value any)

Set function sets the key of type TKey in this safe map to the value. the value should be of type TValue or *TValue, otherwise this function won't do anything at all.

func (*AdvancedMap[TKey, TValue]) SetDefault

func (s *AdvancedMap[TKey, TValue]) SetDefault(value TValue)

func (*AdvancedMap[TKey, TValue]) ToArray

func (s *AdvancedMap[TKey, TValue]) ToArray() []TValue

func (*AdvancedMap[TKey, TValue]) ToList

func (s *AdvancedMap[TKey, TValue]) ToList() GenericList[*TValue]

func (*AdvancedMap[TKey, TValue]) ToNormalMap

func (s *AdvancedMap[TKey, TValue]) ToNormalMap() map[TKey]TValue

func (*AdvancedMap[TKey, TValue]) ToPointerArray

func (s *AdvancedMap[TKey, TValue]) ToPointerArray() []*TValue

type BasicObject

type BasicObject interface {
	IsEmpty() bool
	Length() int
}

type BitsBlocks

type BitsBlocks interface {
	GetBitsSize() int
}

type BytesObject

type BytesObject interface {
	ToBytes() ([]byte, error)
	Length() int
}

type EndpointError

type EndpointError struct {
	ErrorCode int    `json:"code"`
	ErrorType int    `json:"error_type"`
	Message   string `json:"message"`
	Origin    string `json:"origin"`
	Date      string `json:"date"`
}

EndpointError is the generalized form of an error from a HTTP API. this type should be used as a pointer in EndpointResponse.

func (*EndpointError) Error

func (e *EndpointError) Error() string

type EndpointResponse

type EndpointResponse[T any] struct {
	Success bool           `json:"success"`
	Result  *T             `json:"result"`
	Error   *EndpointError `json:"error"`
}

EndpointResponse is the generalized form of a response from a HTTP API.

T field is already a pointer in this struct, please avoid passing a pointer

type, to prevent from `Result` field being a pointer to a pointer.

type ExecuteCommandResult

type ExecuteCommandResult = shellUtils.ExecuteCommandResult

func RunCommand

func RunCommand(command string) *ExecuteCommandResult

func RunCommandAsync

func RunCommandAsync(command string) *ExecuteCommandResult

func RunCommandAsyncWithChan

func RunCommandAsyncWithChan(command string, finishedChan chan bool) *ExecuteCommandResult

RunCommandAsyncWithChan runs the given command in another goroutine and returns back from the function immediately. It will sends `true` to `finishedChan` the moment it's done executing the command.

func RunPowerShell added in v1.1.24

func RunPowerShell(command string) *ExecuteCommandResult

func RunPowerShellAsyncWithChan added in v1.1.24

func RunPowerShellAsyncWithChan(command string, finishedChan chan bool) *ExecuteCommandResult

RunCommandAsyncWithChan runs the given command in another goroutine and returns back from the function immediately. It will sends `true` to `finishedChan` the moment it's done executing the command.

type ExpiringValue

type ExpiringValue[T any] struct {
	// contains filtered or unexported fields
}

func NewEValue

func NewEValue[T any](value T) *ExpiringValue[T]

func (*ExpiringValue[T]) GetTime

func (e *ExpiringValue[T]) GetTime() time.Time

func (*ExpiringValue[T]) GetValue

func (e *ExpiringValue[T]) GetValue() T

func (*ExpiringValue[T]) IsExpired

func (e *ExpiringValue[T]) IsExpired(duration time.Duration) bool

func (*ExpiringValue[T]) Reset

func (e *ExpiringValue[T]) Reset()

func (*ExpiringValue[T]) SetTime

func (e *ExpiringValue[T]) SetTime(t time.Time)

func (*ExpiringValue[T]) SetValue

func (e *ExpiringValue[T]) SetValue(value T)

type GenericList

type GenericList[T comparable] interface {
	BasicObject
	Validator

	Find(element T) int
	Count(element T) int
	Counts(element ...T) int
	Contains(element T) bool
	ContainsAll(elements ...T) bool
	ContainsOne(elements ...T) bool
	Change(index int, element T)
	Exists(element T) bool
	Append(elements ...T)
	Add(elements ...T)
	RemoveAt(index int)
	RemoveOnce(element T)
	RemoveAll(element ...T)
	Remove(element T)
	AsArray() []T
	ToArray() []T
	Clear()
	Get(index int) T
}

func GetEmptyList

func GetEmptyList[T comparable]() GenericList[T]

func GetListFromArray

func GetListFromArray[T comparable](array []T) GenericList[T]

type Int16Container added in v1.1.23

type Int16Container = rangeValues.IntContainer[int16]

type Int32Container added in v1.1.23

type Int32Container = rangeValues.IntContainer[int32]

type Int64Container added in v1.1.23

type Int64Container = rangeValues.IntContainer[int64]

type Int64UniqueIdContainer

type Int64UniqueIdContainer = UniqueIdContainer[int64]

type Int8Container added in v1.1.23

type Int8Container = rangeValues.IntContainer[int8]

type IntegerRepresent

type IntegerRepresent interface {
	ToInt64() int64
	ToUInt64() uint64
	ToInt32() int32
	ToUInt32() uint32
}

type ListW

type ListW[T comparable] struct {
	// contains filtered or unexported fields
}

func (*ListW[T]) Add

func (l *ListW[T]) Add(elements ...T)

func (*ListW[T]) Append

func (l *ListW[T]) Append(elements ...T)

func (*ListW[T]) AsArray

func (l *ListW[T]) AsArray() []T

AsArray returns a copy of the value of this list as an array. please do notice that if you make changes to the underlying values of that array, change won't be applied to the list.

func (*ListW[T]) Change

func (l *ListW[T]) Change(index int, element T)

func (*ListW[T]) Clear

func (l *ListW[T]) Clear()

Clear method clears the whole list.

func (*ListW[T]) Contains

func (l *ListW[T]) Contains(element T) bool

func (*ListW[T]) ContainsAll

func (l *ListW[T]) ContainsAll(elements ...T) bool

func (*ListW[T]) ContainsOne

func (l *ListW[T]) ContainsOne(elements ...T) bool

func (*ListW[T]) Count

func (l *ListW[T]) Count(element T) int

func (*ListW[T]) Counts

func (l *ListW[T]) Counts(element ...T) int

func (*ListW[T]) Exists

func (l *ListW[T]) Exists(element T) bool

func (*ListW[T]) Find

func (l *ListW[T]) Find(element T) int

func (*ListW[T]) Get

func (l *ListW[T]) Get(index int) T

func (*ListW[T]) IsEmpty

func (l *ListW[T]) IsEmpty() bool

func (*ListW[T]) IsThreadSafe

func (l *ListW[T]) IsThreadSafe() bool

func (*ListW[T]) IsValid

func (l *ListW[T]) IsValid() bool

func (*ListW[T]) Length

func (l *ListW[T]) Length() int

func (*ListW[T]) Remove

func (l *ListW[T]) Remove(element T)

func (*ListW[T]) RemoveAll

func (l *ListW[T]) RemoveAll(element ...T)

func (*ListW[T]) RemoveAt

func (l *ListW[T]) RemoveAt(index int)

func (*ListW[T]) RemoveOnce

func (l *ListW[T]) RemoveOnce(element T)

func (*ListW[T]) ToArray

func (l *ListW[T]) ToArray() []T

ToArray is equivalent to AsArray method in any way. it returns a copy of the value of this list as an array. please do notice that if you make changes to the underlying values of that array, change won't be applied to the list.

type MetaDataProvider

type MetaDataProvider interface {
	Get(key string) (string, error)
	GetInt(key string) (int, error)
	GetInt8(key string) (int8, error)
	GetInt16(key string) (int16, error)
	GetInt32(key string) (int32, error)
	GetInt64(key string) (int64, error)
	GetUInt(key string) (uint, error)
	GetUInt8(key string) (uint8, error)
	GetUInt16(key string) (uint16, error)
	GetUInt32(key string) (uint32, error)
	GetUInt64(key string) (uint64, error)
	GetBool(key string) (bool, error)

	GetNoErr(key string) string
	GetIntNoErr(key string) int
	GetInt8NoErr(key string) int8
	GetInt16NoErr(key string) int16
	GetInt32NoErr(key string) int32
	GetInt64NoErr(key string) int64
	GetUIntNoErr(key string) uint
	GetUInt8NoErr(key string) uint8
	GetUInt16NoErr(key string) uint16
	GetUInt32NoErr(key string) uint32
	GetUInt64NoErr(key string) uint64
	GetBoolNoErr(key string) bool

	Set(key, value string)
	SetInt(key string, value int)
	SetInt8(key string, value int8)
	SetInt16(key string, value int16)
	SetInt32(key string, value int32)
	SetInt64(key string, value int64)
	SetUInt(key string, value uint)
	SetUInt8(key string, value uint8)
	SetUInt16(key string, value uint16)
	SetUInt32(key string, value uint32)
	SetUInt64(key string, value uint64)
	SetBool(key string, value bool)
}

MetaDataProvider interface provides useful methods for getting/setting metadata for a data structure.

type NumIdGenerator

type NumIdGenerator[T rangeValues.Integer] struct {
	// contains filtered or unexported fields
}

func NewNumIdGenerator

func NewNumIdGenerator[T rangeValues.Integer]() *NumIdGenerator[T]

func (*NumIdGenerator[T]) Next

func (n *NumIdGenerator[T]) Next() T

Next method returns the next id and will move the current cursor to the next id and will return that. current integer won't be available after this method call.

func (*NumIdGenerator[T]) Reset

func (n *NumIdGenerator[T]) Reset()

Reset method will set the current value to 0.

func (*NumIdGenerator[T]) SafeSet

func (n *NumIdGenerator[T]) SafeSet(current T)

SafeSet method will set the current value to the given value if and only if the passed value is more than current value of the generator. please do notice that with calling n.Next() method, you will get the next id and not the current value.

func (*NumIdGenerator[T]) Set

func (n *NumIdGenerator[T]) Set(current T)

Set method will set the current value to the given value. please do notice that with calling n.Next() method, you will get the next id and not the current value.

type QString

type QString interface {
	BasicObject

	GetValue() string
	GetIndexV(int) rune
	IsEqual(QString) bool
	Split(...QString) []QString
	SplitN(int, ...QString) []QString
	SplitFirst(qs ...QString) []QString
	SplitStr(...string) []QString
	SplitStrN(int, ...string) []QString
	SplitStrFirst(...string) []QString
	Contains(...QString) bool
	ContainsStr(...string) bool
	ContainsAll(...QString) bool
	ContainsStrAll(...string) bool
	TrimPrefix(...QString) QString
	TrimPrefixStr(...string) QString
	TrimSuffix(...QString) QString
	TrimSuffixStr(...string) QString
	Trim(qs ...QString) QString
	TrimStr(...string) QString
	Replace(qs, newS QString) QString
	ReplaceStr(qs, newS string) QString
	LockSpecial()
	UnlockSpecial()
	ToBool() bool
}

func Qsb

func Qsb(b []byte) QString

QSb will generate a new QString with the specified non-encoded bytes value.

func Qss

func Qss(s string) QString

Qss will generate a new QString with the specified non-encoded string value.

func ToQSlice

func ToQSlice(strs []string) []QString

type RangeFloat64

type RangeFloat64 = rangeValues.RangeFloat64

type RangeInt

type RangeInt = rangeValues.IntegerRange[int]

type RangeInt32

type RangeInt32 = rangeValues.IntegerRange[int32]

type RangeInt64

type RangeInt64 = rangeValues.IntegerRange[int64]

type SafeEMap

type SafeEMap[TKey comparable, TValue any] struct {
	// contains filtered or unexported fields
}

SafeEMap is a safe map of type TIndex to pointers of type TValue. this map is completely thread safe and is using internal lock when getting and setting variables. the difference of SafeEMap and SafeMap is that SafeEMap is using a checker loop for removing the expired values from itself.

func NewSafeEMap

func NewSafeEMap[TKey comparable, TValue any]() *SafeEMap[TKey, TValue]

func (*SafeEMap[TKey, TValue]) Add

func (s *SafeEMap[TKey, TValue]) Add(key TKey, value *TValue)

func (*SafeEMap[TKey, TValue]) AddList

func (s *SafeEMap[TKey, TValue]) AddList(keyGetter func(*TValue) TKey, elements ...TValue)

func (*SafeEMap[TKey, TValue]) AddPointerList

func (s *SafeEMap[TKey, TValue]) AddPointerList(keyGetter func(*TValue) TKey, elements ...*TValue)

func (*SafeEMap[TKey, TValue]) Clear

func (s *SafeEMap[TKey, TValue]) Clear()

Clear will clear the whole map.

func (*SafeEMap[TKey, TValue]) Delete

func (s *SafeEMap[TKey, TValue]) Delete(key TKey)

func (*SafeEMap[TKey, TValue]) Disable added in v1.1.27

func (s *SafeEMap[TKey, TValue]) Disable()

Disable will disable this map, meaning that it won't be able to add new values, but will still be able to delete/read values.

func (*SafeEMap[TKey, TValue]) DisableChecking

func (s *SafeEMap[TKey, TValue]) DisableChecking()

func (*SafeEMap[TKey, TValue]) DoCheck

func (s *SafeEMap[TKey, TValue]) DoCheck()

DoCheck iterates over the map and checks for expired variables and removes them. if the `onExpired` member of the map is set, it will call them.

func (*SafeEMap[TKey, TValue]) Enable added in v1.1.27

func (s *SafeEMap[TKey, TValue]) Enable()

Enable will enable this map, meaning that it will be able to add new values.

func (*SafeEMap[TKey, TValue]) EnableChecking

func (s *SafeEMap[TKey, TValue]) EnableChecking()

func (*SafeEMap[TKey, TValue]) Exists

func (s *SafeEMap[TKey, TValue]) Exists(key TKey) bool

func (*SafeEMap[TKey, TValue]) ForEach

func (s *SafeEMap[TKey, TValue]) ForEach(fn func(TKey, *TValue) bool)

func (*SafeEMap[TKey, TValue]) Get

func (s *SafeEMap[TKey, TValue]) Get(key TKey) *TValue

func (*SafeEMap[TKey, TValue]) GetRandom

func (s *SafeEMap[TKey, TValue]) GetRandom() *TValue

func (*SafeEMap[TKey, TValue]) GetRandomKey

func (s *SafeEMap[TKey, TValue]) GetRandomKey() (key TKey, ok bool)

func (*SafeEMap[TKey, TValue]) GetRandomValue

func (s *SafeEMap[TKey, TValue]) GetRandomValue() TValue

func (*SafeEMap[TKey, TValue]) GetValue

func (s *SafeEMap[TKey, TValue]) GetValue(key TKey) TValue

func (*SafeEMap[TKey, TValue]) HasValidTimings

func (s *SafeEMap[TKey, TValue]) HasValidTimings() bool

func (*SafeEMap[TKey, TValue]) IsChecking

func (s *SafeEMap[TKey, TValue]) IsChecking() bool

func (*SafeEMap[TKey, TValue]) IsDisabled added in v1.1.27

func (s *SafeEMap[TKey, TValue]) IsDisabled() bool

IsDisabled returns true if this map is disabled. Disabled maps won't be able to add new values, but will still be able to delete/read values.

func (*SafeEMap[TKey, TValue]) IsEmpty

func (s *SafeEMap[TKey, TValue]) IsEmpty() bool

func (*SafeEMap[TKey, TValue]) IsThreadSafe

func (s *SafeEMap[TKey, TValue]) IsThreadSafe() bool

func (*SafeEMap[TKey, TValue]) IsValid

func (s *SafeEMap[TKey, TValue]) IsValid() bool

func (*SafeEMap[TKey, TValue]) Length

func (s *SafeEMap[TKey, TValue]) Length() int

func (*SafeEMap[TKey, TValue]) Set

func (s *SafeEMap[TKey, TValue]) Set(key TKey, value any)

Set function sets the key of type TKey in this safe map to the value. the value should be of type TValue or *TValue, otherwise this function won't do anything at all.

func (*SafeEMap[TKey, TValue]) SetDefault

func (s *SafeEMap[TKey, TValue]) SetDefault(value TValue)

func (*SafeEMap[TKey, TValue]) SetExpiration

func (s *SafeEMap[TKey, TValue]) SetExpiration(duration time.Duration)

func (*SafeEMap[TKey, TValue]) SetInterval

func (s *SafeEMap[TKey, TValue]) SetInterval(duration time.Duration)

func (*SafeEMap[TKey, TValue]) SetOnExpired

func (s *SafeEMap[TKey, TValue]) SetOnExpired(event func(key TKey, value TValue))

func (*SafeEMap[TKey, TValue]) ToArray

func (s *SafeEMap[TKey, TValue]) ToArray() []TValue

func (*SafeEMap[TKey, TValue]) ToList

func (s *SafeEMap[TKey, TValue]) ToList() GenericList[*TValue]

func (*SafeEMap[TKey, TValue]) ToNormalMap

func (s *SafeEMap[TKey, TValue]) ToNormalMap() map[TKey]TValue

func (*SafeEMap[TKey, TValue]) ToPointerArray

func (s *SafeEMap[TKey, TValue]) ToPointerArray() []*TValue

type SafeMap

type SafeMap[TKey comparable, TValue any] struct {
	// contains filtered or unexported fields
}

SafeMap is a safe map of type TIndex to pointers of type TValue. this map is completely thread safe and is using internal lock when getting and setting variables.

func NewSafeMap

func NewSafeMap[TKey comparable, TValue any]() *SafeMap[TKey, TValue]

func (*SafeMap[TKey, TValue]) Add

func (s *SafeMap[TKey, TValue]) Add(key TKey, value *TValue)

func (*SafeMap[TKey, TValue]) AddList

func (s *SafeMap[TKey, TValue]) AddList(keyGetter func(*TValue) TKey, elements ...TValue)

func (*SafeMap[TKey, TValue]) AddPointerList

func (s *SafeMap[TKey, TValue]) AddPointerList(keyGetter func(*TValue) TKey, elements ...*TValue)

func (*SafeMap[TKey, TValue]) Clear

func (s *SafeMap[TKey, TValue]) Clear()

Clear will clear the whole map.

func (*SafeMap[TKey, TValue]) Delete

func (s *SafeMap[TKey, TValue]) Delete(key TKey)

func (*SafeMap[TKey, TValue]) Disable added in v1.1.27

func (s *SafeMap[TKey, TValue]) Disable()

Disable will disable this map, meaning that it won't be able to add new values, but will still be able to delete/read values.

func (*SafeMap[TKey, TValue]) Enable added in v1.1.27

func (s *SafeMap[TKey, TValue]) Enable()

Enable will enable this map, meaning that it will be able to add new values.

func (*SafeMap[TKey, TValue]) Exists

func (s *SafeMap[TKey, TValue]) Exists(key TKey) bool

func (*SafeMap[TKey, TValue]) ForEach

func (s *SafeMap[TKey, TValue]) ForEach(fn func(TKey, *TValue) bool)

func (*SafeMap[TKey, TValue]) Get

func (s *SafeMap[TKey, TValue]) Get(key TKey) *TValue

func (*SafeMap[TKey, TValue]) GetValue

func (s *SafeMap[TKey, TValue]) GetValue(key TKey) TValue

func (*SafeMap[TKey, TValue]) IsDisabled added in v1.1.27

func (s *SafeMap[TKey, TValue]) IsDisabled() bool

IsDisabled returns true if this map is disabled. Disabled maps won't be able to add new values, but will still be able to delete/read values.

func (*SafeMap[TKey, TValue]) IsEmpty

func (s *SafeMap[TKey, TValue]) IsEmpty() bool

func (*SafeMap[TKey, TValue]) IsThreadSafe

func (s *SafeMap[TKey, TValue]) IsThreadSafe() bool

func (*SafeMap[TKey, TValue]) IsValid

func (s *SafeMap[TKey, TValue]) IsValid() bool

func (*SafeMap[TKey, TValue]) Length

func (s *SafeMap[TKey, TValue]) Length() int

func (*SafeMap[TKey, TValue]) Set

func (s *SafeMap[TKey, TValue]) Set(key TKey, value any)

Set function sets the key of type TKey in this safe map to the value. the value should be of type TValue or *TValue, otherwise this function won't do anything at all.

func (*SafeMap[TKey, TValue]) SetDefault

func (s *SafeMap[TKey, TValue]) SetDefault(value TValue)

func (*SafeMap[TKey, TValue]) ToArray

func (s *SafeMap[TKey, TValue]) ToArray() []TValue

func (*SafeMap[TKey, TValue]) ToList

func (s *SafeMap[TKey, TValue]) ToList() GenericList[*TValue]

func (*SafeMap[TKey, TValue]) ToNormalMap

func (s *SafeMap[TKey, TValue]) ToNormalMap() map[TKey]TValue

func (*SafeMap[TKey, TValue]) ToPointerArray

func (s *SafeMap[TKey, TValue]) ToPointerArray() []*TValue

type Serializer

type Serializer interface {
	Serialize() ([]byte, error)
	StrSerialize() string
}

type SignatureContainer

type SignatureContainer interface {
	GetSignature() string
	SetSignature(signature string) bool
	SetSignatureByBytes(data []byte) bool
	SetSignatureByFunc(h func() hash.Hash) bool
}

type StringUniqueIdContainer

type StringUniqueIdContainer = UniqueIdContainer[string]

type StrongString

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

the StrongString used in the program for additional usage.

func Sb

func Sb(b []byte) StrongString

Sb will generate a new StrongString with the specified non-encoded bytes value.

func Ss

func Ss(s string) StrongString

Ss will generate a new StrongString with the specified non-encoded string value.

func SsPtr

func SsPtr(s string) *StrongString

SS will generate a new StrongString with the specified non-encoded string value.

func (*StrongString) Contains

func (s *StrongString) Contains(qs ...QString) bool

func (*StrongString) ContainsAll

func (s *StrongString) ContainsAll(qs ...QString) bool

func (*StrongString) ContainsStr

func (s *StrongString) ContainsStr(str ...string) bool

func (*StrongString) ContainsStrAll

func (s *StrongString) ContainsStrAll(str ...string) bool

func (*StrongString) GetIndexV

func (s *StrongString) GetIndexV(index int) rune

GetIndexV method will give you the rune in index. if the passed-by `index` is out of range, it will return zero index of the value.

func (*StrongString) GetValue

func (s *StrongString) GetValue() string

GetValue will give you the real value of this StrongString.

func (*StrongString) HasPrefix

func (s *StrongString) HasPrefix(values ...string) bool

HasPrefix will check if at least there is one prefix is presents in this StrongString or not. the StrongString should starts with at least one of these prefixes.

func (*StrongString) HasPrefixes

func (s *StrongString) HasPrefixes(values ...string) bool

HasPrefixes will check if all of the prefixes are present in this StrongString or not. the StrongString should starts with all of these suffixes. usage of this method is not recommended, since you can use HasSuffix method with only one string (the longest string). this way you will just use too much cpu resources.

func (*StrongString) HasRunePrefix

func (s *StrongString) HasRunePrefix(values ...rune) bool

HasRunePrefix will check if at least there is one prefix is presents in this StrongString or not. the StrongString should starts with at least one of these prefixes.

func (*StrongString) HasRunePrefixes

func (s *StrongString) HasRunePrefixes(values ...rune) bool

HasRunePrefixes will check if all of the prefixes are present in this StrongString or not. the StrongString should starts with all of these suffixes. usage of this method is not recommended, since you can use HasSuffix method with only one string (the longest string). this way you will just use too much cpu resources.

func (*StrongString) HasSuffix

func (s *StrongString) HasSuffix(values ...string) bool

HasSuffix will check if at least there is one suffix is presents in this StrongString not. the StrongString should ends with at least one of these suffixes.

func (*StrongString) HasSuffixes

func (s *StrongString) HasSuffixes(values ...string) bool

HasSuffixes will check if all of the suffixes are present in this StrongString or not. the StrongString should ends with all of these suffixes. usage of this method is not recommended, since you can use HasSuffix method with only one string (the longest string). this way you will just use too much cpu resources.

func (*StrongString) IsEmpty

func (s *StrongString) IsEmpty() bool

isEmpty will check if this StrongString is empty or not.

func (*StrongString) IsEqual

func (s *StrongString) IsEqual(q QString) bool

isEqual will check if the passed-by-value in the arg is equal to this StrongString or not.

func (*StrongString) Length

func (s *StrongString) Length() int

length method, will give you the length-as-int of this StrongString.

func (*StrongString) LockSpecial

func (s *StrongString) LockSpecial()

LockSpecial will lock all the defined special characters. This way, you don't actually have to be worry about some normal mistakes in splitting strings, cut them out, check them. join them, etc... WARNING: this method is so dangerous, it's really dangerous. we can't say that it's unsafe actually, but still it's really dangerous, so if you don't know what the fuck are you doing, then please don't use this method. this method will not return you a new value, it will effect the current value. please consider using it carefully.

func (*StrongString) Replace

func (s *StrongString) Replace(qs, newS QString) QString

func (*StrongString) ReplaceStr

func (s *StrongString) ReplaceStr(qs, newS string) QString

func (*StrongString) Split

func (s *StrongString) Split(qs ...QString) []QString

func (*StrongString) SplitFirst

func (s *StrongString) SplitFirst(qs ...QString) []QString

func (*StrongString) SplitN

func (s *StrongString) SplitN(n int, qs ...QString) []QString

func (*StrongString) SplitStr

func (s *StrongString) SplitStr(qs ...string) []QString

func (*StrongString) SplitStrFirst

func (s *StrongString) SplitStrFirst(qs ...string) []QString

func (*StrongString) SplitStrN

func (s *StrongString) SplitStrN(n int, qs ...string) []QString

func (*StrongString) ToBool

func (s *StrongString) ToBool() bool

func (*StrongString) ToQString

func (s *StrongString) ToQString() QString

func (*StrongString) Trim

func (s *StrongString) Trim(qs ...QString) QString

func (*StrongString) TrimPrefix

func (s *StrongString) TrimPrefix(qs ...QString) QString

func (*StrongString) TrimPrefixStr

func (s *StrongString) TrimPrefixStr(qs ...string) QString

func (*StrongString) TrimStr

func (s *StrongString) TrimStr(qs ...string) QString

func (*StrongString) TrimSuffix

func (s *StrongString) TrimSuffix(qs ...QString) QString

func (*StrongString) TrimSuffixStr

func (s *StrongString) TrimSuffixStr(qs ...string) QString

func (*StrongString) UnlockSpecial

func (s *StrongString) UnlockSpecial()

UnlockSpecial will unlock all the defined special characters. it will return them to their normal form.

type UInt16Container added in v1.1.23

type UInt16Container = rangeValues.IntContainer[uint16]

type UInt32Container added in v1.1.23

type UInt32Container = rangeValues.IntContainer[uint32]

type UInt64Container added in v1.1.23

type UInt64Container = rangeValues.IntContainer[uint64]

type UInt8Container added in v1.1.23

type UInt8Container = rangeValues.IntContainer[uint8]

type UniqueIdContainer

type UniqueIdContainer[T comparable] interface {
	GetUniqueId() T
	SetAsUniqueId(value T)
	HasValidUniqueId() bool
}

type Validator

type Validator interface {
	IsValid() bool
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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