Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nhatthm/go-grpc-middleware
gRPC Go Middleware: interceptors, helpers, utilities
https://github.com/nhatthm/go-grpc-middleware
go golang grpc helper interceptor middleware utilities
Last synced: 22 days ago
JSON representation
gRPC Go Middleware: interceptors, helpers, utilities
- Host: GitHub
- URL: https://github.com/nhatthm/go-grpc-middleware
- Owner: nhatthm
- License: mit
- Created: 2021-10-17T08:48:48.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2024-04-15T07:56:50.000Z (9 months ago)
- Last Synced: 2024-05-01T21:04:09.521Z (8 months ago)
- Topics: go, golang, grpc, helper, interceptor, middleware, utilities
- Language: Go
- Homepage:
- Size: 206 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Go gRPC Middleware
[![GitHub Releases](https://img.shields.io/github/v/release/nhatthm/go-grpc-middleware)](https://github.com/nhatthm/go-grpc-middleware/releases/latest)
[![Build Status](https://github.com/nhatthm/go-grpc-middleware/actions/workflows/test.yaml/badge.svg)](https://github.com/nhatthm/go-grpc-middleware/actions/workflows/test.yaml)
[![codecov](https://codecov.io/gh/nhatthm/go-grpc-middleware/branch/master/graph/badge.svg?token=eTdAgDE2vR)](https://codecov.io/gh/nhatthm/go-grpc-middleware)
[![Go Report Card](https://goreportcard.com/badge/github.com/nhatthm/go-grpc-middleware)](https://goreportcard.com/report/github.com/nhatthm/go-grpc-middleware)
[![GoDevDoc](https://img.shields.io/badge/dev-doc-00ADD8?logo=go)](https://pkg.go.dev/github.com/nhatthm/go-grpc-middleware)
[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/donate/?hosted_button_id=PJZSGJN57TDJY)[gRPC Go](https://github.com/grpc/grpc-go) Middleware: interceptors, helpers, utilities.
## Table of Contents
- [Prerequisites](#prerequisites)
- [Install](#install)
- [Interceptors](#interceptors)
- [Ctxd Logger](#ctxd-logger)
- [Timeout](#timeout)## Prerequisites
- `Go >= 1.22`
[[table of contents]](#table-of-contents)
## Install
```bash
go get github.com/nhatthm/go-grpc-middleware
```[[table of contents]](#table-of-contents)
## Interceptors
### Ctxd Logger
See [bool64/ctxd](https://github.com/bool64/ctxd)
- Server middlewares
- `ctxd.UnaryServerInterceptor`
- `ctxd.StreamServerInterceptor`
- Client middlewares
- `ctxd.UnaryClientInterceptor`
- `ctxd.StreamClientInterceptor`[[table of contents]](#table-of-contents)
### Timeout
There are 4 dial options for gRPC client:
- Sleep for a duration before doing the job.
`timeout.WithStreamClientSleepInterceptor`
`timeout.WithUnaryClientSleepInterceptor`
- Automatically creates a new context with given duration if there is none in the current context.
`timeout.WithStreamClientTimeoutInterceptor`
`timeout.WithUnaryClientTimeoutInterceptor`## Donation
If this project help you reduce time to develop, you can give me a cup of coffee :)
[[table of contents]](#table-of-contents)
### Paypal donation
[![paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.paypal.com/donate/?hosted_button_id=PJZSGJN57TDJY)
or scan this
[[table of contents]](#table-of-contents)