mediocre-go-lib

module
v0.0.0-...-c20f884 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2019 License: MIT

README

mediocre-go-lib

This is a collection of packages which I use across many of my personal projects. All packages intended to be used start with an m, packages not starting with m are for internal use within this set of packages.

Usage notes

  • In general, all checking of equality of errors, e.g. err == io.EOF, done on errors returned from the packages in this project should be done using merr.Equal, e.g. merr.Equal(err, io.EOF). The merr package is used to wrap errors and embed further metadata in them, like stack traces and so forth.

Styleguide

Here are general guidelines I use when making decisions about how code in this repo should be written. Most of the guidelines I have come up with myself have to do with package design, since packages are the only thing which have any rigidity and therefore need any rigid rules.

Everything here are guidelines, not actual rules.

  • gofmt -s

  • https://golang.org/doc/effective_go.html

  • https://github.com/golang/go/wiki/CodeReviewComments

  • Package names may be abbreviations of a concept, but types, functions, and methods should all be full words.

  • When deciding if a package should initialize a struct as a value or pointer, a good rule is: If it's used as an immutable value it should be a value, otherwise it's a pointer. Even if the immutable value implementation has internal caching, locks, etc..., that can be hidden as pointers inside the struct, but the struct itself can remain a value type.

  • A function which takes in a context.Context and returns a modified copy of that same context.Context should have a name prefixed with With, e.g. WithValue or WithLogger. Exceptions like Annotate do exist.

Directories

Path Synopsis
cmd
Package jstream defines and implements the JSON Stream protocol Purpose The purpose of the jstream protocol is to provide a very simple layer on top of an existing JSON implementation to allow for streaming arbitrary numbers of JSON objects and byte blobs of arbitrary size in a standard way, and to allow for embedding streams within each other.
Package jstream defines and implements the JSON Stream protocol Purpose The purpose of the jstream protocol is to provide a very simple layer on top of an existing JSON implementation to allow for streaming arbitrary numbers of JSON objects and byte blobs of arbitrary size in a standard way, and to allow for embedding streams within each other.
m
Package m implements functionality specific to how I like my programs to work.
Package m implements functionality specific to how I like my programs to work.
Package mcfg implements the creation of different types of configuration parameters and various methods of filling those parameters from external configuration sources (e.g.
Package mcfg implements the creation of different types of configuration parameters and various methods of filling those parameters from external configuration sources (e.g.
Package mcrypto contains general purpose functionality related to cryptography, notably related to unique identifiers, signing/verifying data, and encrypting/decrypting data
Package mcrypto contains general purpose functionality related to cryptography, notably related to unique identifiers, signing/verifying data, and encrypting/decrypting data
Package mctx extends the builtin context package to add easy-to-use annotation functionality, which is useful for logging and errors.
Package mctx extends the builtin context package to add easy-to-use annotation functionality, which is useful for logging and errors.
mdb
Package mdb contains a number of database wrappers for databases I commonly use
Package mdb contains a number of database wrappers for databases I commonly use
mbigquery
Package mbigquery implements connecting to Google's BigQuery service and simplifying a number of interactions with it.
Package mbigquery implements connecting to Google's BigQuery service and simplifying a number of interactions with it.
mbigtable
Package mbigtable implements connecting to Google's Bigtable service and simplifying a number of interactions with it.
Package mbigtable implements connecting to Google's Bigtable service and simplifying a number of interactions with it.
mdatastore
Package mdatastore implements connecting to Google's Datastore service and simplifying a number of interactions with it.
Package mdatastore implements connecting to Google's Datastore service and simplifying a number of interactions with it.
mpubsub
Package mpubsub implements connecting to Google's PubSub service and simplifying a number of interactions with it.
Package mpubsub implements connecting to Google's PubSub service and simplifying a number of interactions with it.
mredis
Package mredis implements connecting to a redis instance.
Package mredis implements connecting to a redis instance.
msql
Package msql implements connecting to a MySQL/MariaDB instance (and possibly others) and simplifies a number of interactions with it.
Package msql implements connecting to a MySQL/MariaDB instance (and possibly others) and simplifies a number of interactions with it.
Package merr extends the errors package with features like key-value attributes for errors, embedded stacktraces, and multi-errors.
Package merr extends the errors package with features like key-value attributes for errors, embedded stacktraces, and multi-errors.
Package mhttp extends the standard package with extra functionality which is commonly useful
Package mhttp extends the standard package with extra functionality which is commonly useful
Package mlog is a generic logging library.
Package mlog is a generic logging library.
Package mnet extends the standard package with extra functionality which is commonly useful
Package mnet extends the standard package with extra functionality which is commonly useful
Package mrand implements extensions and conveniences for using the default math/rand package.
Package mrand implements extensions and conveniences for using the default math/rand package.
Package mrpc contains types and functionality to facilitate creating RPC interfaces and for making calls against those same interfaces This package contains a few fundamental types: Handler, Call, and Client.
Package mrpc contains types and functionality to facilitate creating RPC interfaces and for making calls against those same interfaces This package contains a few fundamental types: Handler, Call, and Client.
Package mrun provides the ability to register callback hooks on Components, as well as some convenience functions which allow using a context as a wait-group.
Package mrun provides the ability to register callback hooks on Components, as well as some convenience functions which allow using a context as a wait-group.
Package mtest implements functionality useful for testing.
Package mtest implements functionality useful for testing.
massert
Package massert implements an assertion framework which is useful in tests.
Package massert implements an assertion framework which is useful in tests.
mchk
Package mchk implements a framework for writing property checker tests, where test cases are generated randomly and performed, and failing test cases are output in a way so as to easily be able to rerun them.
Package mchk implements a framework for writing property checker tests, where test cases are generated randomly and performed, and failing test cases are output in a way so as to easily be able to rerun them.
Package mtime extends the standard time package with extra functionality
Package mtime extends the standard time package with extra functionality

Jump to

Keyboard shortcuts

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