Skip to content

lspaccatrosi16/go-libs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

Package Description
graph Graph Algorithms. Docs
maths Core mathematical algorithms. Docs
sequences Algorithms 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

Package Description
data Analysis of sample data
regression Calculation 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

Package Description
cartesian Implementation of a cartesian coordinate system
graph Implementation of a graph structure
mpq Implementation of a minimum priority queue
set Implementation of an exclusive set in go
stack Implementation of a stack in go

Licence

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

About

A collection of useful go libraries

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages