fns

package module
v1.2.80 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2024 License: Apache-2.0 Imports: 28 Imported by: 8

README

Fns


Fn services for Golang. Simplify the development process by using standardized development scheme. Every thing is function.

Features

Quickstart

Creation

First: install fns commander.

go install github.com/aacfactory/fns/cmd/fns@latest

Second: use fns create a fns project.

mkdir {your project path}
cd {your project path}
fns init --mod={mod_name} . 

Third: look main.go, configs, modules to understand project structure.

Last: add dependencies and setup config.

Coding
  1. First: create a service ident.
  2. Second: create a function.
  3. Last: run go generate to generate source codes.
  4. Happy coding.
Running

Setup FNS-ACTIVE env, such as FNS-ACTIVE=local, that the fns-local.yaml is used.

View documents

Setup documents, then done, so easy.

Testing
  • Use tests to make writing test units easy.
  • Use pprof to analysis of profiling data.

Cluster

Use hazelcast or redis, and create a proxy server as gateway, then done, so easy.
When used in kubernetes, then inject pod ip into FNS-HOST, and set env into config field cluster.hostRetriever.

Customize transport

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigActiveFromENV added in v0.1.1

func ConfigActiveFromENV(key string) (active string)

Types

type Application

type Application interface {
	Deploy(service ...services.Service) Application
	Run(ctx context.Context) Application
	Sync()
}

func New

func New(options ...Option) (app Application)

type Option

type Option func(*Options) error

func ConfigRetriever

func ConfigRetriever(path string, format string, active string, prefix string, splitter byte) Option

func Handler added in v1.1.0

func Handler(handler transports.MuxHandler) Option

func Hooks

func Hooks(h ...hooks.Hook) Option

func Id added in v0.14.0

func Id(id string) Option

func LogWriters added in v1.2.0

func LogWriters(writers ...logs.Writer) Option

func Middleware added in v1.1.0

func Middleware(middleware transports.Middleware) Option

func Name added in v0.14.0

func Name(name string) Option

func Proxy added in v1.0.10

func Proxy(options ...proxies.Option) Option

func RegisterValidator added in v0.12.0

func RegisterValidator(register validators.ValidateRegister) Option

func ShutdownTimeout added in v0.12.0

func ShutdownTimeout(timeout time.Duration) Option

func Transport added in v1.0.10

func Transport(transport transports.Transport) Option

func Version

func Version(version string) Option

type Options

type Options struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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