golang

module
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2020 License: MIT

README

GoDoc Report card

golang

Useful libs or tools for Golang

GoLibs

  • generator — Generator behaves like Generator in python or ES6, with yield and next statements.
  • signal — Signal enhances signal.Notify with the stacktrace of cgo.
  • sql — Enhance go std sql.
    • NullDuration - NullDuration represents an interface that may be null. NullDuration implements the Scanner interface so it can be used as a scan destination, similar to sql.NullString.
    • NullJson - NullJson represents an interface that may be null. NullJson implements the Scanner interface so it can be used as a scan destination, similar to sql.NullString. Deprecate, use go-nulljson instead. For more information, see: https://pkg.go.dev/github.com/searKing/golang/tools/cmd/go-nulljson
  • ternary_search_tree — A type of trie (sometimes called a prefix tree) where nodes are arranged in a manner similar to a binary search tree, but with up to three children rather than the binary tree's limit of two.
  • connection mux — Connection Mux is a generic Go library to multiplex connections based on their payload. Using cmux, you can serve gRPC, SSH, HTTPS, HTTP, Go RPC, and pretty much any other protocol on the same TCP listener.
  • SniffReader — A Reader that allows sniff and read from the provided input reader. data is buffered if Sniff(true) is called. buffered data is taken first, if Sniff(false) is called.
  • multiple_prefix - Prefixes for decimal and binary multiples, Prefixes for decimal multiples, Prefixes for binary multiples.
  • flag — Enhance go std flag, such as StringSlice that is a flag.Value that accumulates strings, e.g. --flag=one --flag=two would produce []string{"one", "two"}.
  • goroutine — goroutine is a collection of apis about goroutine.
    • ID() — returns goroutine id of the goroutine that calls it.
    • Lock — represents a goroutine ID, with goroutine ID checked, that is whether GoRoutines of lock newer and check caller differ.
  • hashring — hashring provides a consistent hashing function, read more about consistent hashing on wikipedia: Consistent_hashing.

GoGenerateTools

go generate is only useful if you have tools to use it with! Here is an incomplete list of useful tools that generate code.

  • go-syncmap — Generates Go code using a package as a generic template for sync.Map.
  • go-syncpool — Generates Go code using a package as a generic template for sync.Pool.
  • go-atomicvalue — Generates Go code using a package as a generic template for atomic.Value.
  • go-option — Generates Go code using a package as a graceful option.
  • go-nulljson — Generates Go code using a package as a generic template that implements sql.Scanner and sql.Valuer.
  • go-enum — Generates Go code using a package as a generic template, which implements interface fmt.Stringer | binary | json | text | sql | yaml for enums.
  • go-import — Performs auto import of non go files.

Directories

Path Synopsis
tools
cmd/go-atomicvalue
go-atomicvalue Generates Go code using a package as a generic template for atomic.Value.
go-atomicvalue Generates Go code using a package as a generic template for atomic.Value.
cmd/go-enum
go-enum is a tool to automate the creation of methods that satisfy such interfaces: fmt ==> fmt.Stringer binary ==> encoding.BinaryMarshaler and encoding.BinaryUnmarshaler json ==> encoding/json.MarshalJSON and encoding/json.UnmarshalJSON text ==> encoding.TextMarshaler and encoding.TextUnmarshaler sql ==> database/sql.Scanner and database/sql/driver.Valuer yaml ==> gopkg.in/yaml.v2:yaml.Marshaler and gopkg.in/yaml.v2:yaml.Unmarshaler Given the name of a (signed or unsigned) integer type T that has constants defined, stringer will create a new self-contained Go source file implementing fmt ==> fmt.Stringer func (t T) String() string binary ==> encoding.BinaryMarshaler and encoding.BinaryUnmarshaler func (t T) MarshalBinary() (data []byte, err error) func (t *T) UnmarshalBinary(data []byte) error json ==> encoding/json.MarshalJSON and encoding/json.UnmarshalJSON func (t T) MarshalJSON() ([]byte, error) func (t *T) UnmarshalJSON(data []byte) error text ==> encoding.TextMarshaler and encoding.TextUnmarshaler func (t T) MarshalText() ([]byte, error) func (t *T) UnmarshalText(text []byte) error sql ==> database/sql.Scanner and database/sql/driver.Valuer func (t T) Value() (driver.Value, error) func (t *T) Scan(value interface{}) error yaml ==> gopkg.in/yaml.v2:yaml.Marshaler and gopkg.in/yaml.v2:yaml.Unmarshaler func (t T) MarshalYAML() (interface{}, error) func (t *T) UnmarshalYAML(unmarshal func(interface{}) error) error The file is created in the same package and directory as the package that defines T. It has helpful defaults designed for use with go generate.
go-enum is a tool to automate the creation of methods that satisfy such interfaces: fmt ==> fmt.Stringer binary ==> encoding.BinaryMarshaler and encoding.BinaryUnmarshaler json ==> encoding/json.MarshalJSON and encoding/json.UnmarshalJSON text ==> encoding.TextMarshaler and encoding.TextUnmarshaler sql ==> database/sql.Scanner and database/sql/driver.Valuer yaml ==> gopkg.in/yaml.v2:yaml.Marshaler and gopkg.in/yaml.v2:yaml.Unmarshaler Given the name of a (signed or unsigned) integer type T that has constants defined, stringer will create a new self-contained Go source file implementing fmt ==> fmt.Stringer func (t T) String() string binary ==> encoding.BinaryMarshaler and encoding.BinaryUnmarshaler func (t T) MarshalBinary() (data []byte, err error) func (t *T) UnmarshalBinary(data []byte) error json ==> encoding/json.MarshalJSON and encoding/json.UnmarshalJSON func (t T) MarshalJSON() ([]byte, error) func (t *T) UnmarshalJSON(data []byte) error text ==> encoding.TextMarshaler and encoding.TextUnmarshaler func (t T) MarshalText() ([]byte, error) func (t *T) UnmarshalText(text []byte) error sql ==> database/sql.Scanner and database/sql/driver.Valuer func (t T) Value() (driver.Value, error) func (t *T) Scan(value interface{}) error yaml ==> gopkg.in/yaml.v2:yaml.Marshaler and gopkg.in/yaml.v2:yaml.Unmarshaler func (t T) MarshalYAML() (interface{}, error) func (t *T) UnmarshalYAML(unmarshal func(interface{}) error) error The file is created in the same package and directory as the package that defines T. It has helpful defaults designed for use with go generate.
cmd/go-import
go-import Performs auto import of non go files.
go-import Performs auto import of non go files.
cmd/go-nulljson
go-nulljson Generates Go code using a package as a generic template that implements database/sql.Scanner and database/sql/driver.Valuer.
go-nulljson Generates Go code using a package as a generic template that implements database/sql.Scanner and database/sql/driver.Valuer.
cmd/go-option
Typically this process would be run using go generate, like this: //go:generate go-option -type=Pill With no arguments, it processes the package in the current directory.
Typically this process would be run using go generate, like this: //go:generate go-option -type=Pill With no arguments, it processes the package in the current directory.
cmd/go-syncmap
go-syncmap Generates Go code using a package as a generic template for sync.Map.
go-syncmap Generates Go code using a package as a generic template for sync.Map.
cmd/go-syncpool
go-syncpool Generates Go code using a package as a generic template for sync.Pool.
go-syncpool Generates Go code using a package as a generic template for sync.Pool.

Jump to

Keyboard shortcuts

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