Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/short-loop/shortloop-go
The official Go SDK for ShortLoop (shortloop.dev)
https://github.com/short-loop/shortloop-go
api gin go golang mux sdk shortloop
Last synced: 4 days ago
JSON representation
The official Go SDK for ShortLoop (shortloop.dev)
- Host: GitHub
- URL: https://github.com/short-loop/shortloop-go
- Owner: short-loop
- Created: 2023-01-21T10:37:50.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-10-18T13:01:37.000Z (about 1 year ago)
- Last Synced: 2024-10-11T09:41:25.852Z (about 1 month ago)
- Topics: api, gin, go, golang, mux, sdk, shortloop
- Language: Go
- Homepage:
- Size: 48.8 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Shortloop SDK for Go
`shortloop-go` provides client implementation of Shortloop SDK for the Go programming
language.## Requirements
Current SDK version requires Go 1.17 or higher.
For Gin framework, it requires gin version 1.4.0 or higher.## Installation
`shortloop-go` can be installed like any other Go library through `go get`:
```console
$ go get github.com/short-loop/shortloop-go@latest
```
## Usage1. Import sdk in your code
For gin:
```Go
import "github.com/short-loop/shortloop-go/shortloopgin"
```
For mux:
```Go
import "github.com/short-loop/shortloop-go/shortloopmux"
```5. Initialize the sdk
Example for gin:
```Go
router := gin.Default()
sdk, err := shortloopgin.Init(shortloopgin.Options{
ShortloopEndpoint: "http://localhost:8080",
ApplicationName: "test-service-go",
LoggingEnabled: true,
LogLevel: "INFO",
})
if err != nil {
fmt.Println("Error initializing shortloopgin: ", err)
} else {
router.Use(sdk.Filter())
}
```
Example for mux:
```Go
mux := mux.NewRouter()
sdk, err := shortloopmux.Init(shortloopmux.Options{
ShortloopEndpoint: "http://localhost:8080",
ApplicationName: "test-service-go",
LoggingEnabled: true,
LogLevel: "INFO",
})
if err != nil {
fmt.Println("Error initializing shortloopmux: ", err)
} else {
mux.Use(sdk.Filter)
}
```