mnc

package module
v0.0.0-...-2ba9a79 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

README

mnc

micro wrapper around nats

env:

NATS_URL=nats://127.0.0.1:4222

package usage:

package main
import "github.com/ituoga/mnc"

type Response struct {
    Name string `json:"name"`
}

type Request struct {
    Name string `json:"name"`
}

func main() {
    response, err := mnc.Call[Response]("function.on.topic", Request{"hello world"})
    if err != nil {
        panic(err)
    }
    log.Printf("%+#v", response)
}

and you could simply test that app with natscli

https://github.com/nats-io/natscli

by runing

nats reply --echo "function.on.topic"

and go run yoruapp.main.go

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Call

func Call[R any](topic string, payload any) (*R, error)

func Request

func Request(topic string, payload []byte) ([]byte, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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