Documentation ¶
Index ¶
- Variables
- func NewAES() *aes.Config
- func NewCompressor(err error) compress.Compressor
- func NewEd25519() *ed25519.Config
- func NewEncoder(err error) encoding.Encoder
- func NewHMAC() *hmac.Config
- func NewHook() *hooks.Config
- func NewInputConfig(flag string) *cmd.InputConfig
- func NewInsecureConfig() *tls.Config
- func NewInsecureDebugConfig() *debug.Config
- func NewInsecureTransportConfig() *transport.Config
- func NewLimiterConfig(kind, interval string, tokens uint64) *limiter.Config
- func NewLogger(lc fx.Lifecycle) *zap.Logger
- func NewMeter(lc fx.Lifecycle, c *metrics.Config) metric.Meter
- func NewMeterProvider(lc fx.Lifecycle, config *metrics.Config) metric.MeterProvider
- func NewOTLPMeter(lc fx.Lifecycle) metric.Meter
- func NewOTLPMeterProvider(lc fx.Lifecycle) metric.MeterProvider
- func NewOTLPMetricsConfig() *metrics.Config
- func NewOTLPTracerConfig() *tracer.Config
- func NewOutputConfig(flag string) *cmd.OutputConfig
- func NewPGConfig() *pg.Config
- func NewPrometheusMeter(lc fx.Lifecycle) metric.Meter
- func NewPrometheusMeterProvider(lc fx.Lifecycle) metric.MeterProvider
- func NewPrometheusMetricsConfig() *metrics.Config
- func NewRSA() *rsa.Config
- func NewRedisConfig(secret, compressor, encoder string) *redis.Config
- func NewRetry() *retry.Config
- func NewSSH() *ssh.Config
- func NewSecureDebugConfig() *debug.Config
- func NewSecureTransportConfig() *transport.Config
- func NewTLSClientConfig() *tls.Config
- func NewTLSConfig(c, k string) *tls.Config
- func NewTLSServerConfig() *tls.Config
- func NewToken(kind string) *token.Config
- func NewTracer(lc fx.Lifecycle, config *tracer.Config, logger *zap.Logger) trace.Tracer
- func Path(p string) string
- func Port() string
- func ProtobufSayHello(_ context.Context, r *v1.SayHelloRequest) (*v1.SayHelloResponse, error)
- func RegisterHandlers[Res any](path string, h content.Handler[Res])
- func RegisterRequestHandlers[Req any, Res any](path string, h content.RequestHandler[Req, Res])
- func Test(ctx context.Context) meta.Valuer
- func Timeout() (context.Context, context.CancelFunc)
- func WithTest(ctx context.Context, value meta.Valuer) context.Context
- type BadEd25519Signer
- type BadFS
- type BadReaderCloser
- type BadResponseWriter
- type BadServer
- type Cache
- type Client
- type Generator
- type InvalidMeter
- func (InvalidMeter) Float64Counter(string, ...metric.Float64CounterOption) (metric.Float64Counter, error)
- func (InvalidMeter) Float64Gauge(string, ...metric.Float64GaugeOption) (metric.Float64Gauge, error)
- func (InvalidMeter) Float64Histogram(string, ...metric.Float64HistogramOption) (metric.Float64Histogram, error)
- func (InvalidMeter) Float64ObservableCounter(string, ...metric.Float64ObservableCounterOption) (metric.Float64ObservableCounter, error)
- func (InvalidMeter) Float64ObservableGauge(string, ...metric.Float64ObservableGaugeOption) (metric.Float64ObservableGauge, error)
- func (InvalidMeter) Float64ObservableUpDownCounter(string, ...metric.Float64ObservableUpDownCounterOption) (metric.Float64ObservableUpDownCounter, error)
- func (InvalidMeter) Float64UpDownCounter(string, ...metric.Float64UpDownCounterOption) (metric.Float64UpDownCounter, error)
- func (InvalidMeter) Int64Counter(string, ...metric.Int64CounterOption) (metric.Int64Counter, error)
- func (InvalidMeter) Int64Gauge(string, ...metric.Int64GaugeOption) (metric.Int64Gauge, error)
- func (InvalidMeter) Int64Histogram(string, ...metric.Int64HistogramOption) (metric.Int64Histogram, error)
- func (InvalidMeter) Int64ObservableCounter(string, ...metric.Int64ObservableCounterOption) (metric.Int64ObservableCounter, error)
- func (InvalidMeter) Int64ObservableGauge(string, ...metric.Int64ObservableGaugeOption) (metric.Int64ObservableGauge, error)
- func (InvalidMeter) Int64ObservableUpDownCounter(string, ...metric.Int64ObservableUpDownCounterOption) (metric.Int64ObservableUpDownCounter, error)
- func (InvalidMeter) Int64UpDownCounter(string, ...metric.Int64UpDownCounterOption) (metric.Int64UpDownCounter, error)
- func (InvalidMeter) RegisterCallback(metric.Callback, ...metric.Observable) (metric.Registration, error)
- type NoopServer
- type PageData
- type Request
- type Response
- func ErrorSayHello(_ context.Context, _ *Request) (*Response, error)
- func NoContent(_ context.Context, _ *Request) (*Response, error)
- func RestContent(ctx context.Context) (*Response, error)
- func RestError(_ context.Context) (*Response, error)
- func RestNoContent(_ context.Context) (*Response, error)
- func RestRequestContent(ctx context.Context, req *Request) (*Response, error)
- func RestRequestError(_ context.Context, _ *Request) (*Response, error)
- func RestRequestNoContent(_ context.Context, _ *Request) (*Response, error)
- func SuccessSayHello(ctx context.Context, r *Request) (*Response, error)
- type Server
- type Service
- type Shutdowner
- type Todo
- type Verifier
- type World
- func (w *World) DebugHost() string
- func (w *World) EventsContext(ctx context.Context) context.Context
- func (w *World) OpenDatabase() (*mssqlx.DBs, error)
- func (w *World) Register()
- func (w *World) RegisterEvents(ctx context.Context)
- func (w *World) ResponseWithBody(ctx context.Context, protocol, address, method, path string, ...) (*http.Response, string, error)
- func (w *World) ResponseWithNoBody(ctx context.Context, protocol, address, method, path string, ...) (*http.Response, error)
- func (w *World) ServerHost() string
- type WorldOption
- func WithWorldCompression() WorldOption
- func WithWorldLimiter(config *limiter.Config) WorldOption
- func WithWorldPGConfig(config *pg.Config) WorldOption
- func WithWorldRedisConfig(config *redis.Config) WorldOption
- func WithWorldRest() WorldOption
- func WithWorldRoundTripper(rt http.RoundTripper) WorldOption
- func WithWorldSecure() WorldOption
- func WithWorldTelemetry(kind string) WorldOption
- func WithWorldToken(generator token.Generator, verifier token.Verifier) WorldOption
Constants ¶
This section is empty.
Variables ¶
var ( // Environment for test. Environment = env.Environment("dev") // Version for test. Version = env.Version("1.0.0") // Name for test. Name = env.Name("test") // UserAgent for test. UserAgent = env.UserAgent(string(Name) + "/" + string(Version)) )
var ( // ErrGenerate for test. ErrGenerate = errors.New("token error") // ErrInvalid for test. ErrInvalid = errors.New("invalid match") // ErrFailed for test. ErrFailed = errors.New("failed") )
var ( //go:embed views/*.tmpl //go:embed static/*.txt Views embed.FS // Model for test. Model = PageData{ Title: "My TODO list", Todos: []Todo{ {Title: "Task 1", Done: false}, {Title: "Task 2", Done: true}, {Title: "Task 3", Done: true}, }, } )
var Compressor = compress.NewMap()
Compressor for tests.
var Content = content.NewContent(Encoder)
Content for tests.
var Encoder = encoding.NewMap()
Encoder for tests.
var FS = os.NewFS()
FS used for tests.
var Pool = sync.NewBufferPool()
Pool for tests.
Functions ¶
func NewCompressor ¶ added in v1.57.3
func NewCompressor(err error) compress.Compressor
NewCompressor for test.
func NewEncoder ¶ added in v1.282.0
NewEncoder for test.
func NewInputConfig ¶ added in v1.186.0
func NewInputConfig(flag string) *cmd.InputConfig
NewInputConfig for test.
func NewInsecureConfig ¶ added in v1.174.0
NewSecureClientConfig for test.
func NewInsecureDebugConfig ¶ added in v1.154.7
NewInsecureDebugConfig for test.
func NewInsecureTransportConfig ¶ added in v1.113.0
NewInsecureTransportConfig for test.
func NewLimiterConfig ¶ added in v1.166.0
NewLimiterConfig for test.
func NewMeterProvider ¶ added in v1.265.0
NewMeterProvider for test.
func NewOTLPMeter ¶ added in v1.172.0
NewOTLPMeter for test.
func NewOTLPMeterProvider ¶ added in v1.265.0
func NewOTLPMeterProvider(lc fx.Lifecycle) metric.MeterProvider
NewOTLPMeterProvider for test.
func NewOTLPMetricsConfig ¶ added in v1.152.0
NewOTLPMetricsConfig for test.
func NewOTLPTracerConfig ¶ added in v1.152.0
NewOTLPTracerConfig for test.
func NewOutputConfig ¶ added in v1.186.0
func NewOutputConfig(flag string) *cmd.OutputConfig
NewOutputConfig for test.
func NewPrometheusMeter ¶ added in v1.172.0
NewPrometheusMeter for test.
func NewPrometheusMeterProvider ¶ added in v1.265.0
func NewPrometheusMeterProvider(lc fx.Lifecycle) metric.MeterProvider
NewPrometheusMeterProvider for test.
func NewPrometheusMetricsConfig ¶ added in v1.152.0
NewPrometheusMetricsConfig for test.
func NewRedisConfig ¶ added in v1.76.0
NewRedisConfig for test.
func NewSecureDebugConfig ¶ added in v1.154.7
NewInsecureDebugConfig for test.
func NewSecureTransportConfig ¶ added in v1.113.0
NewSecureTransportConfig for test.
func NewTLSClientConfig ¶ added in v1.180.0
NewTLSClientConfig for test.
func NewTLSConfig ¶ added in v1.180.0
NewTLSConfig for test.
func NewTLSServerConfig ¶ added in v1.180.0
NewTLSServerConfig for test.
func ProtobufSayHello ¶ added in v1.245.0
func ProtobufSayHello(_ context.Context, r *v1.SayHelloRequest) (*v1.SayHelloResponse, error)
ProtobufSayHello for test.
func RegisterHandlers ¶ added in v1.381.1
RegisterHandlers for test.
func RegisterRequestHandlers ¶ added in v1.381.1
func RegisterRequestHandlers[Req any, Res any](path string, h content.RequestHandler[Req, Res])
RegisterRequestHandlers for test.
Types ¶
type BadEd25519Signer ¶ added in v1.373.1
type BadEd25519Signer struct{}
BadEd25519Signer for test.
func (*BadEd25519Signer) PrivateKey ¶ added in v1.373.1
func (s *BadEd25519Signer) PrivateKey() ed25519.PrivateKey
func (*BadEd25519Signer) PublicKey ¶ added in v1.373.1
func (s *BadEd25519Signer) PublicKey() ed25519.PublicKey
func (*BadEd25519Signer) Sign ¶ added in v1.373.1
func (s *BadEd25519Signer) Sign(_ string) (string, error)
func (*BadEd25519Signer) Verify ¶ added in v1.373.1
func (s *BadEd25519Signer) Verify(_, _ string) error
type BadFS ¶ added in v1.375.0
type BadFS struct{}
BadFS for test.
func (*BadFS) FileExists ¶ added in v1.375.0
type BadReaderCloser ¶ added in v1.380.0
type BadReaderCloser struct{}
BadReaderCloser for test.
func (*BadReaderCloser) Close ¶ added in v1.380.0
func (r *BadReaderCloser) Close() error
Close returns ErrFailed.
type BadResponseWriter ¶ added in v1.371.0
type BadResponseWriter struct {
Code int
}
BadResponseWriter for test.
func (*BadResponseWriter) Header ¶ added in v1.371.0
func (w *BadResponseWriter) Header() http.Header
Header is always empty.
func (*BadResponseWriter) Write ¶ added in v1.371.0
func (w *BadResponseWriter) Write([]byte) (int, error)
Write returns ErrFailed.
func (*BadResponseWriter) WriteHeader ¶ added in v1.371.0
func (w *BadResponseWriter) WriteHeader(code int)
WriteHeader stored the code in the field Code.
type BadServer ¶ added in v1.365.0
type BadServer struct{}
BadServer for test.
type Cache ¶ added in v1.172.2
type Cache struct { Lifecycle fx.Lifecycle Redis *redis.Config Logger *zap.Logger Tracer *tracer.Config Meter metric.Meter }
Cache for test.
func (*Cache) NewRedisCache ¶ added in v1.172.2
NewRedisCache for test.
type Client ¶ added in v1.172.2
type Client struct { Lifecycle fx.Lifecycle Logger *zap.Logger Tracer *tracer.Config Transport *transport.Config TLS *tls.Config ID id.Generator RoundTripper http.RoundTripper Meter metric.Meter Generator token.Generator Compression bool }
Client for test.
func (*Client) NewGRPC ¶ added in v1.172.2
func (c *Client) NewGRPC() *grpc.ClientConn
type Generator ¶ added in v1.32.3
type Generator struct {
// contains filtered or unexported fields
}
Generator for test.
func NewGenerator ¶ added in v1.4.0
NewGenerator for test.
type InvalidMeter ¶ added in v1.161.0
InvalidMeter for test.
func (InvalidMeter) Float64Counter ¶ added in v1.161.0
func (InvalidMeter) Float64Counter(string, ...metric.Float64CounterOption) (metric.Float64Counter, error)
func (InvalidMeter) Float64Gauge ¶ added in v1.200.0
func (InvalidMeter) Float64Gauge(string, ...metric.Float64GaugeOption) (metric.Float64Gauge, error)
func (InvalidMeter) Float64Histogram ¶ added in v1.161.0
func (InvalidMeter) Float64Histogram(string, ...metric.Float64HistogramOption) (metric.Float64Histogram, error)
func (InvalidMeter) Float64ObservableCounter ¶ added in v1.161.0
func (InvalidMeter) Float64ObservableCounter(string, ...metric.Float64ObservableCounterOption) (metric.Float64ObservableCounter, error)
func (InvalidMeter) Float64ObservableGauge ¶ added in v1.161.0
func (InvalidMeter) Float64ObservableGauge(string, ...metric.Float64ObservableGaugeOption) (metric.Float64ObservableGauge, error)
func (InvalidMeter) Float64ObservableUpDownCounter ¶ added in v1.161.0
func (InvalidMeter) Float64ObservableUpDownCounter(string, ...metric.Float64ObservableUpDownCounterOption) (metric.Float64ObservableUpDownCounter, error)
func (InvalidMeter) Float64UpDownCounter ¶ added in v1.161.0
func (InvalidMeter) Float64UpDownCounter(string, ...metric.Float64UpDownCounterOption) (metric.Float64UpDownCounter, error)
func (InvalidMeter) Int64Counter ¶ added in v1.161.0
func (InvalidMeter) Int64Counter(string, ...metric.Int64CounterOption) (metric.Int64Counter, error)
func (InvalidMeter) Int64Gauge ¶ added in v1.200.0
func (InvalidMeter) Int64Gauge(string, ...metric.Int64GaugeOption) (metric.Int64Gauge, error)
func (InvalidMeter) Int64Histogram ¶ added in v1.161.0
func (InvalidMeter) Int64Histogram(string, ...metric.Int64HistogramOption) (metric.Int64Histogram, error)
func (InvalidMeter) Int64ObservableCounter ¶ added in v1.161.0
func (InvalidMeter) Int64ObservableCounter(string, ...metric.Int64ObservableCounterOption) (metric.Int64ObservableCounter, error)
func (InvalidMeter) Int64ObservableGauge ¶ added in v1.161.0
func (InvalidMeter) Int64ObservableGauge(string, ...metric.Int64ObservableGaugeOption) (metric.Int64ObservableGauge, error)
func (InvalidMeter) Int64ObservableUpDownCounter ¶ added in v1.161.0
func (InvalidMeter) Int64ObservableUpDownCounter(string, ...metric.Int64ObservableUpDownCounterOption) (metric.Int64ObservableUpDownCounter, error)
func (InvalidMeter) Int64UpDownCounter ¶ added in v1.161.0
func (InvalidMeter) Int64UpDownCounter(string, ...metric.Int64UpDownCounterOption) (metric.Int64UpDownCounter, error)
func (InvalidMeter) RegisterCallback ¶ added in v1.161.0
func (InvalidMeter) RegisterCallback(metric.Callback, ...metric.Observable) (metric.Registration, error)
type NoopServer ¶ added in v1.365.0
type NoopServer struct{}
NoopServer for test.
func (*NoopServer) IsEnabled ¶ added in v1.365.0
func (s *NoopServer) IsEnabled() bool
func (*NoopServer) Serve ¶ added in v1.365.0
func (s *NoopServer) Serve() error
func (*NoopServer) Shutdown ¶ added in v1.365.0
func (s *NoopServer) Shutdown(_ context.Context) error
func (*NoopServer) String ¶ added in v1.365.0
func (s *NoopServer) String() string
type Response ¶ added in v1.241.0
Response for test.
func ErrorSayHello ¶ added in v1.245.0
ErrorSayHello for test.
func RestContent ¶ added in v1.315.0
RestNoContent for test.
func RestNoContent ¶ added in v1.315.0
RestNoContent for test.
func RestRequestContent ¶ added in v1.346.0
RestRequestContent for test.
func RestRequestError ¶ added in v1.346.0
RestRequestError for test.
func RestRequestNoContent ¶ added in v1.346.0
RestRequestNoContent for test.
type Server ¶
type Server struct { Lifecycle fx.Lifecycle Meter metric.Meter Verifier token.Verifier Mux *http.ServeMux HTTPServer *th.Server GRPCServer *tg.Server DebugServer *debug.Server TransportConfig *transport.Config DebugConfig *debug.Config Tracer *tracer.Config Limiter *limiter.Limiter Logger *zap.Logger ID id.Generator VerifyAuth bool }
Server for test.
type Service ¶ added in v1.172.2
type Service struct { v1.UnimplementedGreeterServiceServer // contains filtered or unexported fields }
Service ...
func (*Service) SayHello ¶ added in v1.172.2
func (s *Service) SayHello(ctx context.Context, req *v1.SayHelloRequest) (*v1.SayHelloResponse, error)
SayHello ...
func (*Service) SayStreamHello ¶ added in v1.172.2
func (s *Service) SayStreamHello(stream v1.GreeterService_SayStreamHelloServer) error
SayStreamHello ...
type Shutdowner ¶
type Shutdowner struct {
// contains filtered or unexported fields
}
func NewShutdowner ¶
func NewShutdowner() *Shutdowner
func (*Shutdowner) Called ¶ added in v1.66.4
func (s *Shutdowner) Called() bool
func (*Shutdowner) Shutdown ¶
func (s *Shutdowner) Shutdown(...fx.ShutdownOption) error
type Verifier ¶ added in v1.32.3
type Verifier struct {
// contains filtered or unexported fields
}
Verifier for test.
type World ¶ added in v1.381.1
type World struct { *fxtest.Lifecycle *http.ServeMux *zap.Logger Tracer *tracer.Config PG *pg.Config *Server *Client *mvc.Router *events.Event *eh.Receiver *Cache Sender client.Client Rest *resty.Client // contains filtered or unexported fields }
World for test.
func NewWorld ¶ added in v1.381.1
func NewWorld(t *testing.T, opts ...WorldOption) *World
NewWorld for test.
func (*World) EventsContext ¶ added in v1.381.1
EventsContext for world.
func (*World) OpenDatabase ¶ added in v1.381.1
OpenDatabase for world.
func (*World) RegisterEvents ¶ added in v1.381.1
RegisterEvents for world.
func (*World) ResponseWithBody ¶ added in v1.383.0
func (w *World) ResponseWithBody(ctx context.Context, protocol, address, method, path string, header http.Header, body io.Reader) (*http.Response, string, error)
ResponseWithBody for the world.
func (*World) ResponseWithNoBody ¶ added in v1.383.0
func (w *World) ResponseWithNoBody(ctx context.Context, protocol, address, method, path string, header http.Header, body io.Reader) (*http.Response, error)
HTTPResponseNoBody for the world.
func (*World) ServerHost ¶ added in v1.383.0
ServerHost for world.
type WorldOption ¶ added in v1.381.1
type WorldOption interface {
// contains filtered or unexported methods
}
WorldOption for test.
func WithWorldCompression ¶ added in v1.381.1
func WithWorldCompression() WorldOption
WithWorldLimiter for test.
func WithWorldLimiter ¶ added in v1.381.1
func WithWorldLimiter(config *limiter.Config) WorldOption
WithWorldLimiter for test.
func WithWorldPGConfig ¶ added in v1.383.0
func WithWorldPGConfig(config *pg.Config) WorldOption
WithWorldRedisConfig for test.
func WithWorldRedisConfig ¶ added in v1.381.1
func WithWorldRedisConfig(config *redis.Config) WorldOption
WithWorldRedisConfig for test.
func WithWorldRoundTripper ¶ added in v1.381.1
func WithWorldRoundTripper(rt http.RoundTripper) WorldOption
WithWorldRoundTripper for test.
func WithWorldSecure ¶ added in v1.381.1
func WithWorldSecure() WorldOption
WithWorldSecure for test.
func WithWorldTelemetry ¶ added in v1.381.1
func WithWorldTelemetry(kind string) WorldOption
WithWorldTelemetry for test.
func WithWorldToken ¶ added in v1.381.1
func WithWorldToken(generator token.Generator, verifier token.Verifier) WorldOption
WithWorldToken for test.