Categorygithub.com/soyart/gsl
modulepackage
0.0.0-20241010172303-f8eb2a1eb0b3
Repository: https://github.com/soyart/gsl.git
Documentation: pkg.go.dev

# README

gsl: Go Soylib

gsl provides frequently used functionalities that I use across my projects.

It is my personal learning project.

Since Go is focused on simplicity, some battery-included kind of built-ins are not included in Go (and that's a good thing). This led programmers to manually implement these basic solutions, and this led to a lot of duplicate code, oversighted bugs, etc.

This is where gsl comes in - to standardize and store frequently used generic business logic for soy and non-soy devs alike.

Since 2023, Go 1.21 was released with many "battery-included" standard packages, such as "slices", that does many of the things gsl does, so you might want to explore those packages first before gsl.

Go also has released many official extra packages.

  • gsl - basic utilities for everyday use

  • soyutils - utilities for soy devs

  • http - providing wrapper for Go's http package

  • data - basic data structure library. Highly unstable, because this is where I learn to code data structures

  • concurrent - simple stupid concurrency helper functions

  • sqlquery - interface-based SQL query builder to complement squirrel on features such as INSERT ALL or upserts

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Functions

Attempts set retry attempts.
No description provided by the author
No description provided by the author
CollectPointers iterates over |arr| and returns a new slice containing all references to the elements of |arr|.
CollectPointersIf iterates over |arr| and calling filterFunc on the element |elem|.
CompareInterfaceValues will compares |a| and |b| as type T.
Contains iterates over |arr| and returns true if an element in |arr| is equal to |item|.
CopySlice return a copy of |arr|.
DefaultValue is just an alias to ZeroedValue.
Delay sets retry delay.
DerefValues iterates over |arr| and return a new slice containing dereferenced values of the elements in |arr|.
DerefValuesIf iterates over |arr| and calls |filterFunc| on the element |elem|.
FilterSlice iterates over |arr| and calls |filterFunc| on each of the element |elem|.
GroupConsecutive *sorts* slice |s| in-place, and calls GroupConsecutiveSorted on |s|.
GroupConsecutiveSorted groups input numbers in slice []N |s| that are consecutive to each other (i.e.
InterfaceTo converts v from interface{} to T.
No description provided by the author
No description provided by the author
IsWellClosed validates if all surrounds are properly closed # Examples (see unit test) 1.
LastErrorOnly sets retry option to only return the last error.
Map maps |arr| to a new slice using |mapFunc|.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Retry wraps retry with action string.
RetryWithReturn wraps |f| in a `func() error` and captures the T value in that function, and returns T returned by |f|.
Reverse returns a new slice, with elements being those of |arr| after being reversed.
ReverseInPlace reverses |arr| in-place.
SliceFromMapKeys collects map[K]V |m| into []K.
SliceFromMapKeysIf iterates over |m| and calls |f| with keys and values of |m|.
SliceFromMapValues collects map[K]V |m| into []V.
SliceFromMapValuesIf iterates over |m| and calls |f| with keys and values of |m|.
SlicesFromMap collects map[K]V |m| into ([]K, []V).
SlicesFromMapIf iterates over |m| and calls |f| with keys and values of |m|.
StopOnError sets a specific error, which, if seen when retrying, breaks the retry loop.
StringerToLowerString calls String() on s and returns the result of calling `strings.ToLower` on that string.
StringerToUpperString calls String() on s and returns the result of calling `strings.ToUpper` on that string.
No description provided by the author
No description provided by the author
No description provided by the author
ZeroedValue returns default, zeroed value of type T.

# Variables

No description provided by the author
No description provided by the author

# Interfaces

No description provided by the author

# Type aliases

RetryOption is a function that takes in (and modifies) *Config.