Categorygithub.com/devboxhq/go-utils
module
0.0.5
Repository: https://github.com/devboxhq/go-utils.git
Documentation: pkg.go.dev

# README

Go Utils

Utilities and packages containing helpful code!

List of packages:

  • Path related (util)
  • Serialization (util)
  • GRPC Middleware (grpc/middleware)
  • JWT Auth (auth/jwt)

Installation

go get -u github.com/devboxhq/go-utils

Examples

  • get root path based on relative path
import "github.com/devboxhq/go-utils/pkg/util"

func main() {
    path := util.FromRootPath("binaries")
}
  • json to bytes
import "github.com/devboxhq/go-utils/pkg/util"

func main() {
    data := util.MustJsonToBytes(jsonData)
}
  • GRPC zap middleware
import (
    "github.com/devboxhq/go-utils/pkg/grpc/middleware"
    "go.uber.org/zap"
    "google.golang.org/grpc"
)

func main() {
    logger, _ := zap.NewProduction()

    // create manager and add zap middleware
    manager := middleware.Manager{}
    _ = manager.AddMiddleware(middleware.NewZapMiddleware())

    // provide middlewares to GRPC server
    grpcServer := grpc.NewServer(manager.BuildServerOptions()...)
}

# Packages

No description provided by the author
No description provided by the author
No description provided by the author