Skip to content
This repository has been archived by the owner on Mar 15, 2024. It is now read-only.

Commit

Permalink
Prepare v0.10.0 (#12)
Browse files Browse the repository at this point in the history
Fix #11
  • Loading branch information
im-kulikov authored Feb 24, 2019
1 parent d636b75 commit e537e13
Show file tree
Hide file tree
Showing 22 changed files with 29 additions and 2,950 deletions.
31 changes: 15 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ It contains the following components for rapid prototyping of your projects:
- Logger - [zap](https://go.uber.org/zap) is blazing fast, structured, leveled logging in Go
- DI - based on [DIG](https://go.uber.org/dig). A reflection based dependency injection toolkit for Go.
- Module - set of tools for working with the DI component
- NATS - [nats](https://github.com/nats-io/go-nats) and [NSS](https://github.com/nats-io/nats-streaming-server), client for the cloud native messaging system
- ORM - client module for [ORM](https://github.com/go-pg/pg) with focus on PostgreSQL features and performance
- redis - module for type-safe [Redis](https://github.com/go-redis/redis) client for Golang
- [NATS](https://github.com/go-helium/nats) - [nats](https://github.com/nats-io/go-nats) and [NSS](https://github.com/nats-io/nats-streaming-server), client for the cloud native messaging system
- [PostgreSQL](https://github.com/go-helium/postgres) - client module for [ORM](https://github.com/go-pg/pg) with focus on PostgreSQL features and performance
- [Redis](https://github.com/go-helium/redis) - module for type-safe [Redis](https://github.com/go-redis/redis) client for Golang
- Settings - based on [Viper](https://github.com/spf13/viper). A complete configuration solution for Go applications including 12-Factor apps. It is designed to work within an application, and can handle all types of configuration needs and formats
- Web - [see more](#web-module)
- Workers - are tools to run goroutines and do arbitrary work on a schedule along with a mechanism to safely stop each one. Based on [chapsuk/worker](https://github.com/chapsuk/worker)
Expand Down Expand Up @@ -118,7 +118,7 @@ LOGGER_LEVEL=info

## NATS Module

Module provides you with the following things:
[Module](https://github.com/go-helium/nats) provides you with the following things:
- [`*nats.Conn`](https://godoc.org/github.com/nats-io/go-nats#Conn) represents a bare connection to a nats-server. It can send and receive []byte payloads
- [`stan.Conn`](https://godoc.org/github.com/nats-io/go-nats-streaming#Conn) represents a connection to the NATS Streaming subsystem. It can Publish and Subscribe to messages within the NATS Streaming cluster.

Expand Down Expand Up @@ -173,9 +173,9 @@ NATS_PASSWORD=string
NATS_TOKEN=string
```

## ORM Module
## PostgreSQL Module

Module provides you connection to PostgreSQL server
[Module](https://github.com/go-helium/postgres) provides you connection to PostgreSQL server
- `*pg.DB` is a database handle representing a pool of zero or more underlying connections. It's safe for concurrent use by multiple goroutines

Configuration:
Expand All @@ -201,7 +201,7 @@ POSTGRES_POOL_SIZE=int

## Redis Module

Module provides you connection to Redis server
[Module](https://github.com/go-helium/redis) provides you connection to Redis server
- `*redis.Client` is a Redis client representing a pool of zero or more underlying connections. It's safe for concurrent use by multiple goroutines

Configuration:
Expand Down Expand Up @@ -260,7 +260,7 @@ Viper is a prioritized configuration registry. It maintains a set of configurati
- [pprof](https://golang.org/pkg/net/http/pprof/) endpoint
- [metrics](https://github.com/prometheus/client_golang) enpoint (by Prometheus)
- **api** endpoint by passing http.Handler from DI
- `EngineModule` boilerplate that preconfigures echo.Engine for you
- [`echo.Module`](https://github.com/go-helium/echo) boilerplate that preconfigures echo.Engine for you
- with custom Binder / Logger / Validator / ErrorHandler

Configuration:
Expand Down Expand Up @@ -358,7 +358,6 @@ import (
"github.com/im-kulikov/helium/module"
"github.com/im-kulikov/helium/settings"
"github.com/im-kulikov/helium/web"
"github.com/labstack/echo/v4"
"go.uber.org/dig"
"go.uber.org/zap"
)
Expand All @@ -375,25 +374,25 @@ func main() {
grace.Module,
settings.Module,
web.ServersModule,
web.EngineModule,
logger.Module,
))
err = dig.RootCause(err)
helium.Catch(err)
err = h.Invoke(runner)
err = dig.RootCause(err)
helium.Catch(err)
}

func handler(e *echo.Echo) http.Handler {
e.GET("/ping", func(ctx echo.Context) error {
return ctx.String(http.StatusOK, "pong")
func handler() http.Handler {
h := http.NewServeMux()
h.HandleFunc("/ping", func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
_, _ = w.Write([]byte("OK"))
})
return e
return h
}

func runner(ctx context.Context, s mserv.Server, l *zap.Logger) {
func runner(s mserv.Server, l *zap.Logger, ctx context.Context) {
l.Info("run servers")
s.Start()

Expand Down
24 changes: 0 additions & 24 deletions defaults/modules.go

This file was deleted.

12 changes: 6 additions & 6 deletions examples/demo4/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"github.com/im-kulikov/helium/module"
"github.com/im-kulikov/helium/settings"
"github.com/im-kulikov/helium/web"
"github.com/labstack/echo/v4"
"go.uber.org/dig"
"go.uber.org/zap"
)
Expand All @@ -28,7 +27,6 @@ func main() {
grace.Module,
settings.Module,
web.ServersModule,
web.EngineModule,
logger.Module,
))
err = dig.RootCause(err)
Expand All @@ -38,11 +36,13 @@ func main() {
helium.Catch(err)
}

func handler(e *echo.Echo) http.Handler {
e.GET("/ping", func(ctx echo.Context) error {
return ctx.String(http.StatusOK, "pong")
func handler() http.Handler {
h := http.NewServeMux()
h.HandleFunc("/ping", func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
_, _ = w.Write([]byte("OK"))
})
return e
return h
}

func runner(s mserv.Server, l *zap.Logger, ctx context.Context) {
Expand Down
32 changes: 2 additions & 30 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,41 +3,18 @@ module github.com/im-kulikov/helium
require (
bou.ke/monkey v1.0.1
github.com/BurntSushi/toml v0.3.1 // indirect
github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da // indirect
github.com/boltdb/bolt v1.3.1 // indirect
github.com/bsm/redis-lock v8.0.0+incompatible // indirect
github.com/chapsuk/mserv v0.4.1
github.com/chapsuk/wait v0.3.1 // indirect
github.com/chapsuk/worker v0.4.0
github.com/davecgh/go-spew v1.1.1
github.com/go-pg/pg v7.1.7+incompatible
github.com/go-playground/locales v0.12.1 // indirect
github.com/go-playground/universal-translator v0.16.0 // indirect
github.com/go-redis/redis v6.15.1+incompatible
github.com/go-sql-driver/mysql v1.4.1 // indirect
github.com/gogo/protobuf v1.2.0 // indirect
github.com/gopherjs/gopherjs v0.0.0-20181103185306-d547d1d9531e // indirect
github.com/hashicorp/go-immutable-radix v1.0.0 // indirect
github.com/hashicorp/go-msgpack v0.5.3 // indirect
github.com/hashicorp/go-uuid v1.0.1 // indirect
github.com/hashicorp/raft v1.0.0 // indirect
github.com/jinzhu/inflection v0.0.0-20180308033659-04140366298a // indirect
github.com/jtolds/gls v4.2.1+incompatible // indirect
github.com/kr/pretty v0.1.0 // indirect
github.com/labstack/echo/v4 v4.0.0
github.com/labstack/gommon v0.2.8
github.com/leodido/go-urn v1.1.0 // indirect
github.com/lib/pq v1.0.0 // indirect
github.com/nats-io/gnatsd v1.3.0 // indirect
github.com/nats-io/go-nats v1.7.0
github.com/nats-io/go-nats-streaming v0.4.0
github.com/nats-io/nats-streaming-server v0.11.2
github.com/nats-io/nkeys v0.0.2 // indirect
github.com/nats-io/nuid v1.0.0 // indirect
github.com/onsi/ginkgo v1.7.0 // indirect
github.com/onsi/gomega v1.4.3 // indirect
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c // indirect
github.com/pkg/errors v0.8.1
github.com/pkg/errors v0.8.1 // indirect
github.com/prometheus/client_golang v0.9.2
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90 // indirect
github.com/prometheus/common v0.2.0 // indirect
Expand All @@ -47,22 +24,17 @@ require (
github.com/smartystreets/goconvey v0.0.0-20181108003508-044398e4856c
github.com/spf13/afero v1.2.1 // indirect
github.com/spf13/viper v1.3.1
github.com/stretchr/testify v1.3.0
github.com/stretchr/testify v1.3.0 // indirect
github.com/urfave/cli v1.20.0
go.uber.org/atomic v1.3.2 // indirect
go.uber.org/dig v1.7.0
go.uber.org/multierr v1.1.0 // indirect
go.uber.org/zap v1.9.1
golang.org/x/crypto v0.0.0-20190131182504-b8fe1690c613 // indirect
golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3 // indirect
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 // indirect
golang.org/x/sys v0.0.0-20190203050204-7ae0202eb74c // indirect
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2 // indirect
google.golang.org/appengine v1.4.0 // indirect
google.golang.org/genproto v0.0.0-20190201180003-4b09977fb922 // indirect
google.golang.org/grpc v1.18.0 // indirect
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
gopkg.in/go-playground/assert.v1 v1.2.1 // indirect
gopkg.in/go-playground/validator.v9 v9.26.0
mellium.im/sasl v0.2.1 // indirect
)
Loading

0 comments on commit e537e13

Please sign in to comment.