Categorygithub.com/lspaccatrosi16/go-libs
repository
0.3.0
Repository: https://github.com/lspaccatrosi16/go-libs.git
Documentation: pkg.go.dev

# 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

# README

Assorted Go Libraries

  • algorithms - Various algorithms implemented in go
  • gbin - Binary serialisation for (almost) every go data structure
  • interpolator - String interpolation from maps of data
  • statistics - Statistics library
  • structures - Data structures implemented in go

algorithms

PackageDescription
graphGraph Algorithms. Docs
mathsCore mathematical algorithms. Docs
sequencesAlgorithms relating to sequences. Docs

gbin

Golang binary serialisation. Infers schema from go's type system.

[!CAUTION] Data will not be able to be unserialised if the underlying type changes.

Encoding

encoder := gbin.NewEncoder[T]()
encoded, err := encoder.Encode(&data)

Decoding

decoder := gbin.NewDecoder[T]()
decoded, err := decoder.Decode(encoded)

Where encoded / decoded are of type []byte.

EncodeStream & DecodeStream can be used alternatively, which perform the same underlying function, but work with io.Writer and io.Reader respectively.


interpolator

Interpolate a string from a map of values.

E.g.

data := interpolator.Object{
    "a": "b",
    "c": interpolator.Object{
        "foo":1
        "bar":true
    }
}

input := "$a comes after a, but $c.foo doesn't come after $c.bar"

res,err := interpolator.ParseString(input, data)

Will produce a result of:

b comes after a, but 1 doesn't come after true


statistics

PackageDescription
dataAnalysis of sample data
regressionCalculation of regressions on bivariate data

[!CAUTION] Unless explicitely stated, all data is assumed to be sample data, and thus will use Bessel's correction


structures

PackageDescription
cartesianImplementation of a cartesian coordinate system
graphImplementation of a graph structure
mpqImplementation of a minimum priority queue
setImplementation of an exclusive set in go
stackImplementation of a stack in go

Licence

This project is availible under the Apache-2.0 licence. See LICENCE for details.