keeltest

package
v0.12.2 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2023 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPClient

type HTTPClient struct {
	http.Client
	BaseURL string
}

func NewHTTPClient

func NewHTTPClient(opts ...HTTPClientOption) *HTTPClient

func (*HTTPClient) Get

func (c *HTTPClient) Get(ctx context.Context, path string) ([]byte, int, error)

func (*HTTPClient) Post

func (c *HTTPClient) Post(ctx context.Context, path string, data interface{}) ([]byte, int, error)

type HTTPClientOption

type HTTPClientOption func(c *HTTPClient)

func HTTPClientWithBaseURL

func HTTPClientWithBaseURL(v string) HTTPClientOption

func HTTPClientWithCookieJar

func HTTPClientWithCookieJar(v *cookiejar.Jar) HTTPClientOption

type Logger

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

func NewLogger added in v0.6.2

func NewLogger(t zaptest.TestingT, opts ...LoggerOption) *Logger

func (*Logger) T added in v0.6.2

func (l *Logger) T(t zaptest.TestingT) *Logger

func (*Logger) Zap added in v0.6.2

func (l *Logger) Zap() *zap.Logger

type LoggerOption added in v0.6.2

type LoggerOption func(*LoggerOptions)

func LoggerWithLevel added in v0.6.2

func LoggerWithLevel(o zapcore.LevelEnabler) LoggerOption

LoggerWithLevel adds zap.Option's to a test Logger built by NewLogger.

func LoggerWithZapOptions added in v0.6.2

func LoggerWithZapOptions(o ...zap.Option) LoggerOption

LoggerWithZapOptions adds zap.Option's to a test Logger built by NewLogger.

type LoggerOptions added in v0.6.2

type LoggerOptions struct {
	Level zapcore.LevelEnabler
	// contains filtered or unexported fields
}

type Option

type Option func(inst *Server)

Option func

func WithConfig

func WithConfig(c *viper.Viper) Option

WithConfig option

func WithContext

func WithContext(ctx context.Context) Option

WithContext option

func WithLogFields

func WithLogFields(fields ...zap.Field) Option

WithLogFields option

func WithLogger

func WithLogger(l *zap.Logger) Option

WithLogger option

type Server

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

func NewServer

func NewServer(opts ...Option) *Server

func (*Server) AddService

func (s *Server) AddService(service Service)

AddService add a single service

func (*Server) AddServices

func (s *Server) AddServices(services ...Service)

AddServices adds multiple service

func (*Server) Config

func (s *Server) Config() *viper.Viper

Config returns server config

func (*Server) Context

func (s *Server) Context() context.Context

Context returns server context

func (*Server) GetService

func (s *Server) GetService(name string) Service

func (*Server) Logger

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

Logger returns server logger

func (*Server) Meter added in v0.10.0

func (s *Server) Meter() metric.Meter

Meter returns the implementation meter

func (*Server) Start

func (s *Server) Start()

Start starts all registered services

func (*Server) Tracer added in v0.10.0

func (s *Server) Tracer() trace.Tracer

Tracer returns the implementation tracer

type Service

type Service interface {
	URL() string
	Name() string
	Start(ctx context.Context) error
	Close(ctx context.Context) error
}

Service interface

type ServiceHTTP

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

ServiceHTTP struct

func NewServiceHTTP

func NewServiceHTTP(l *zap.Logger, name string, handler http.Handler, middlewares ...middleware.Middleware) *ServiceHTTP

func (*ServiceHTTP) Close

func (s *ServiceHTTP) Close(_ context.Context) error

func (*ServiceHTTP) Logger

func (s *ServiceHTTP) Logger() *zap.Logger

func (*ServiceHTTP) Name

func (s *ServiceHTTP) Name() string

func (*ServiceHTTP) Start

func (s *ServiceHTTP) Start(ctx context.Context) error

func (*ServiceHTTP) URL

func (s *ServiceHTTP) URL() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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