water

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2023 License: MIT Imports: 7 Imported by: 6

README

go-water 是一款设计层面的框架,帮助 web 框架(gin,iris,beego,echo等)实现隔离友好,设计优美的系统,通过一系列接口、规范、约定,深度解耦系统。

星星增长趋势

Stargazers over time

安装

go get -u github.com/go-water/water

样例仓库

官方文档

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config added in v0.0.10

type Config struct {
	Level     zapcore.Level `yaml:"level"`
	Encoding  string        `yaml:"encoding"`
	CallFull  bool          `yaml:"call_full"`
	Color     bool          `yaml:"color"`
	AddCaller bool          `yaml:"add_caller"`
}

func (*Config) NewLogger added in v0.0.10

func (conf *Config) NewLogger() *zap.Logger

type Endpoint

type Endpoint func(ctx context.Context, req any) (any, error)

type ErrorHandler

type ErrorHandler interface {
	Handle(ctx context.Context, err error)
}

type ErrorHandlerFunc

type ErrorHandlerFunc func(ctx context.Context, err error)

func (ErrorHandlerFunc) Handle

func (f ErrorHandlerFunc) Handle(ctx context.Context, err error)

type Handler

type Handler interface {
	ServerWater(ctx context.Context, req any) (any, error)
	GetLogger() *zap.Logger
}

func NewHandler

func NewHandler(srv Service, options ...ServerOption) Handler

type LogErrorHandler

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

func NewLogErrorHandler

func NewLogErrorHandler(l *zap.Logger, n string) *LogErrorHandler

func (*LogErrorHandler) Handle

func (h *LogErrorHandler) Handle(ctx context.Context, err error)

type Server

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

func (*Server) GetLogger added in v0.0.22

func (s *Server) GetLogger() *zap.Logger

func (*Server) GetRequest added in v0.1.1

func (s *Server) GetRequest() any

func (*Server) ServerWater added in v0.0.16

func (s *Server) ServerWater(ctx context.Context, req any) (resp any, err error)

type ServerBase added in v0.0.12

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

func (*ServerBase) GetLogger added in v0.0.18

func (s *ServerBase) GetLogger() *zap.Logger

func (*ServerBase) Name added in v0.0.12

func (s *ServerBase) Name(srv any) string

func (*ServerBase) SetLogger added in v0.0.19

func (s *ServerBase) SetLogger(l *zap.Logger)

type ServerFinalizerFunc

type ServerFinalizerFunc func(ctx context.Context, err error)

type ServerOption

type ServerOption func(*Server)

func ServerConfig added in v0.0.10

func ServerConfig(c *Config) ServerOption

func ServerErrorHandler added in v0.0.5

func ServerErrorHandler(errorHandler ErrorHandler) ServerOption

func ServerFinalizer added in v0.0.5

func ServerFinalizer(f ...ServerFinalizerFunc) ServerOption

type Service

type Service interface {
	Endpoint() Endpoint
	Name() string
	SetLogger(l *zap.Logger)
	GetRequest() any
}

Jump to

Keyboard shortcuts

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