goext

module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2026 License: Apache-2.0

README

goext

A Go utility library of extension packages for common infrastructure work: data structures, concurrency, I/O, networking, time, logging, and database clients.

Packages live under github.com/AlexStocks/goext/... and typically use a gx prefix (gxtime, gxsync, gxdeque, and so on). Many of them started as helpers for dubbogo and related services, then grew into a standalone SDK. History is recorded in change_log.md.

This tree is a local copy of github.com/AlexStocks/goext. There is no root go.mod; import it GOPATH-style (or via a replace directive) as github.com/AlexStocks/goext/<path>.

Packages

Containers
Path Package Description
container/array gxarray Slice helpers such as element removal
container/bitmap gxbitmap Bit set
container/btree btree In-memory B-Tree of arbitrary degree (from Google's btree)
container/cache In-memory TTL cache (from go-cache)
container/deque gxdeque Double-ended queue
container/hashtable gxhashtable Concurrent cuckoo hash table
container/queue In-memory queue, disk-backed queue, and mmap bigqueue
container/ring Ring / circular buffers
container/set gxset Type-safe, zero-allocation sets for basic types
container/xorlist XOR doubly linked list
Concurrency and runtime
Path Package Description
sync gxsync Trylock, semaphore, file lock, distributed RWMutex, unbounded channel
sync/atomic gxatomic Atomic wrappers around numeric types, bool, and string
sync/deadlock gxdeadlock Deadlock-detecting mutex wrappers
sync/errgroup gxerrgroup Error-aware goroutine groups
sync/pool gxpool Object pool and worker pool
runtime gxruntime Goroutine ID and goroutine pool
runtime/pprof gxpprof Process profiling helpers
context Context value helpers
sort/selector gxselector Smooth weighted load-balancing selector
Time, I/O, and hashing
Path Package Description
time gxtime Time wheel, ticker, strftime, sleep, parse, and Unix conversion helpers
time/timespan gxtimespan Time interval / span types
io/kv/disk gxdiskv Persistent filesystem key-value store
io/ring mmap-backed circular buffer
io/rsync rsync-style file sync client and server
io/ioutil File read/write helpers
hash/consistent gxconsistent Consistent hashing with bounded loads
hash/jump Jump consistent hash
bytes/buffer Byte buffer and pool
compress/gzip, compress/zlib gzip / zip helpers
encoding/json JSON object helpers (gabs)
syscall gxsyscall Portable mmap / msync
crypto/xor XOR helpers
Networking, OS, and strings
Path Package Description
net Host/IP address helpers
net/reuseport gxreuseport SO_REUSEPORT TCP/UDP listeners
net/url Short URL helpers
os gxos Path, file, and fallocate helpers
os/process gxprocess Process inspection (Linux, Darwin, Windows)
os/signal gxos Signal handling
path/filepath gxfilepath Path helpers
strings gxstrings String/slice utilities, UUID, nil checks
math, math/rand Power helpers, random strings, red-packet split
log gxlog log4go-style logger, color print, pretty struct dump
log/kafka Kafka producer and consumer wrappers
testing gxtesting Test helpers
Database and service registry
Path Package Description
database/elasticsearch gxelasticsearch Elasticsearch client, including bulk insert
database/etcd etcd client with restart handling
database/influxdb InfluxDB client
database/redis Redis client and instance discovery
database/sql/driver MySQL driver helpers
database/zookeeper ZooKeeper client
database/registry gxregistry Service register / discovery interface
database/registry/etcdv3 etcd v3 registry backend
database/registry/zookeeper ZooKeeper registry backend
database/filter Service attribute filters

Usage

Import individual packages; there is no single root API.

import (
    "github.com/AlexStocks/goext/container/deque"
    "github.com/AlexStocks/goext/sync"
    "github.com/AlexStocks/goext/time"
)

d := gxdeque.New()
d.PushBack("item")

See package-level README.md files and *_test.go examples under each directory for more detail.

License

Apache License 2.0. See LICENSE. Some vendored subpackages keep their original licenses (MIT or Apache 2.0) in their own directories.

Directories

Path Synopsis
compress
container
array
package gxarray provide array/slice related algorithms
package gxarray provide array/slice related algorithms
btree
Package btree implements in-memory B-Trees of arbitrary degree.
Package btree implements in-memory B-Trees of arbitrary degree.
deque
2017/08/21 Package gxdeque implements deque(double-eneded queue) in golang.
2017/08/21 Package gxdeque implements deque(double-eneded queue) in golang.
queue
ref: https://github.com/eapache/queue/blob/master/queue.go
ref: https://github.com/eapache/queue/blob/master/queue.go
queue/disk
https://github.com/nsqio/go-diskqueue
https://github.com/nsqio/go-diskqueue
ring
package rbuf
package rbuf
set
Package set is a type-safe, zero-allocation port of the excellent package fatih/set.
Package set is a type-safe, zero-allocation port of the excellent package fatih/set.
Package gxcontext provides a key-value context
Package gxcontext provides a key-value context
crypto
xor
Package gxxor implements the xor crypto alg.
Package gxxor implements the xor crypto alg.
database
elasticsearch
2017-04-02 02:04 package gxelasticsearch provides a Elasticsearch driver
2017-04-02 02:04 package gxelasticsearch provides a Elasticsearch driver
filter
Package gxfilter provides a interface for service filter
Package gxfilter provides a interface for service filter
filter/pool
Package gxpool provides a service pool filter
Package gxpool provides a service pool filter
influxdb
2018-10-23 21:46 package gxinfluxdb provides a InfluxDB driver
2018-10-23 21:46 package gxinfluxdb provides a InfluxDB driver
redis
2017-08-12 11:57 Package gxredis provides a redis driver by sentinel ref: https://github.com/alexstocks/go-sentinel/blob/master/sentinel.go
2017-08-12 11:57 Package gxredis provides a redis driver by sentinel ref: https://github.com/alexstocks/go-sentinel/blob/master/sentinel.go
registry
Package gxregistry provides a interface for service register/discovery
Package gxregistry provides a interface for service register/discovery
registry/etcdv3
Package gxetcd provides an etcd version 3 gxregistry
Package gxetcd provides an etcd version 3 gxregistry
registry/zookeeper
Package gxzookeeper provides a zookeeper registry
Package gxzookeeper provides a zookeeper registry
sql/driver
2016-09-11 19:30 Package gxdriver provides a MySQL driver for Go's database/sql package code example: https://github.com/alexstocks/go-practice/blob/master/mysql/stmt.go
2016-09-11 19:30 Package gxdriver provides a MySQL driver for Go's database/sql package code example: https://github.com/alexstocks/go-practice/blob/master/mysql/stmt.go
zookeeper
Package gxzookeeper provides a zookeeper driver based on samuel/go-zookeeper/zk
Package gxzookeeper provides a zookeeper driver based on samuel/go-zookeeper/zk
encoding
json
Package gxjson implements a simplified wrapper around creating and parsing JSON.
Package gxjson implements a simplified wrapper around creating and parsing JSON.
hash
consistent
An implementation of Consistent Hashing and Consistent Hashing With Bounded Loads.
An implementation of Consistent Hashing and Consistent Hashing With Bounded Loads.
jump
From the paper "A Fast, Minimal Memory, Consistent Hash Algorithm" by John Lamping, Eric Veach (2014).
From the paper "A Fast, Minimal Memory, Consistent Hash Algorithm" by John Lamping, Eric Veach (2014).
io
ioutil
Package gxioutil implements some I/O utility functions.
Package gxioutil implements some I/O utility functions.
rsync
Package gxrsync implements a rsync-based algorithm for sending delta updates to a remote server.
Package gxrsync implements a rsync-based algorithm for sending delta updates to a remote server.
log
package gxlog is based on log4go.
package gxlog is based on log4go.
kafka
Package gxkafka encapsulates some kafka functions based on github.com/Shopify/sarama.
Package gxkafka encapsulates some kafka functions based on github.com/Shopify/sarama.
gxmath provides some pow likely functions
gxmath provides some pow likely functions
rand
Package gxrand encapsulates some golang.math.rand functions
Package gxrand encapsulates some golang.math.rand functions
net
Package gxnet encapsulates some network functions
Package gxnet encapsulates some network functions
reuseport
Package gxreuseport provides a function that returns a net.Listener powered by a net.FileListener with a SO_REUSEPORT option set to the socket.
Package gxreuseport provides a function that returns a net.Listener powered by a net.FileListener with a SO_REUSEPORT option set to the socket.
url
2017-10-31 14:30 Package gxurl implements URL function encapsulation
2017-10-31 14:30 Package gxurl implements URL function encapsulation
os
packaeg gxos encapsulates os related functions.
packaeg gxos encapsulates os related functions.
process
packaeg gxprocess is used to get process info of "/proc"
packaeg gxprocess is used to get process info of "/proc"
path
filepath
Package gxfilepath encapsulates some path.filepath functions ref: https://github.com/rogpeppe/go-internal/blob/master/dirhash/hash.go
Package gxfilepath encapsulates some path.filepath functions ref: https://github.com/rogpeppe/go-internal/blob/master/dirhash/hash.go
2017-10-24 16:20 Package gxruntime encapsulates some runtime functions goroutine pool ref: https://github.com/pingcap/tidb/blob/1592c7bc2873346565ab15ecfbc22749a775e014/util/goroutine_pool/gp.go
2017-10-24 16:20 Package gxruntime encapsulates some runtime functions goroutine pool ref: https://github.com/pingcap/tidb/blob/1592c7bc2873346565ab15ecfbc22749a775e014/util/goroutine_pool/gp.go
pprof
Package autopprof provides a development-time library to collect pprof profiles from Go programs.
Package autopprof provides a development-time library to collect pprof profiles from Go programs.
sort
http://blog.csdn.net/siddontang/article/details/23541587 reflect.StringHeader和reflect.SliceHeader的结构体只相差末尾一个字段(cap) vitess代码,一种很hack的做法,string和slice的转换只需要拷贝底层的指针,而不是内存拷贝。
http://blog.csdn.net/siddontang/article/details/23541587 reflect.StringHeader和reflect.SliceHeader的结构体只相差末尾一个字段(cap) vitess代码,一种很hack的做法,string和slice的转换只需要拷贝底层的指针,而不是内存拷贝。
atomic
Package gxatomic provides simple wrappers around numerics to enforce atomic access.
Package gxatomic provides simple wrappers around numerics to enforce atomic access.
errgroup
Package gxerrgroup implements an actor-runner with deterministic teardown.
Package gxerrgroup implements an actor-runner with deterministic teardown.
pool
Package pool implements a pool of Object interfaces to manage and reuse them.
Package pool implements a pool of Object interfaces to manage and reuse them.
Package mmap allows mapping files into memory.
Package mmap allows mapping files into memory.
Package gxtesting encapsulates some golang.testing functions
Package gxtesting encapsulates some golang.testing functions
Package gxtime encapsulates some golang.time functions
Package gxtime encapsulates some golang.time functions
timespan
Package gxtime encapsulates some golang.time functions refers from https://github.com/senseyeio/spaniel/blob/master/interval.go
Package gxtime encapsulates some golang.time functions refers from https://github.com/senseyeio/spaniel/blob/master/interval.go

Jump to

Keyboard shortcuts

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