keeltest

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2022 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Logger

func Logger(t zaptest.TestingT) *zap.Logger

Types

type HTTPClient

type HTTPClient struct {
	http.Client
	// contains filtered or unexported fields
}

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 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) Start

func (s *Server) Start()

Start starts all registered services

type Service

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

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)

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)

func (*ServiceHTTP) URL

func (s *ServiceHTTP) URL() string

Jump to

Keyboard shortcuts

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