mice

package module
v1.2.8 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2021 License: MIT Imports: 10 Imported by: 0

README

mice

PkgGoDev

Opinionated microservice framework designed for deployment on Kubernetes.

Minimal example:

package main

import (
	"github.com/MouseHatGames/mice"
	"github.com/MouseHatGames/mice-plugins/codec/json"
	"github.com/MouseHatGames/mice-plugins/transport/grpc"
)

func main() {
	svc := mice.NewService(
		options.Name("my-service"),
		options.RPCPort(8080),
		json.Codec(),
		grpc.Transport(),
	)

	if err := svc.Start(); err != nil {
		log.Fatalf("failed to start: %v", err)
	}
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Service

type Service interface {
	// Apply applies one or more options to the service's configuration
	Apply(opts ...options.Option)

	Env() options.Environment
	Config() config.Config
	Name() string

	Server() server.Server
	Client() client.Client

	Start() error
}

Service represents a service that can receive and send requests

func NewService

func NewService(opts ...options.Option) Service

NewService instantiates a new service and initializes it with options

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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