Documentation ¶
Index ¶
- Constants
- func WithServerURL(ctx context.Context, u *url.URL) context.Context
- type CachingParams
- type Client
- func (c *Client) Caching(ctx context.Context, params CachingParams) (WorldObjects, error)
- func (c *Client) DB(ctx context.Context) (*WorldObject, error)
- func (c *Client) JSON(ctx context.Context) (*HelloWorld, error)
- func (c *Client) Queries(ctx context.Context, params QueriesParams) (WorldObjects, error)
- func (c *Client) Updates(ctx context.Context, params UpdatesParams) (WorldObjects, error)
- type ClientOption
- type ErrorHandler
- type Handler
- type HelloWorld
- func (s *HelloWorld) Decode(d *jx.Decoder) error
- func (s *HelloWorld) Encode(e *jx.Encoder)
- func (s *HelloWorld) GetMessage() string
- func (s *HelloWorld) MarshalJSON() ([]byte, error)
- func (s *HelloWorld) SetFake()
- func (s *HelloWorld) SetMessage(val string)
- func (s *HelloWorld) UnmarshalJSON(data []byte) error
- type Invoker
- type Middleware
- type Option
- type QueriesParams
- type Route
- type Server
- type ServerOption
- func WithErrorHandler(h ErrorHandler) ServerOption
- func WithMaxMultipartMemory(max int64) ServerOption
- func WithMethodNotAllowed(methodNotAllowed func(w http.ResponseWriter, r *http.Request, allowed string)) ServerOption
- func WithMiddleware(m ...Middleware) ServerOption
- func WithNotFound(notFound http.HandlerFunc) ServerOption
- func WithPathPrefix(prefix string) ServerOption
- type UnimplementedHandler
- func (UnimplementedHandler) Caching(ctx context.Context, params CachingParams) (r WorldObjects, _ error)
- func (UnimplementedHandler) DB(ctx context.Context) (r *WorldObject, _ error)
- func (UnimplementedHandler) JSON(ctx context.Context) (r *HelloWorld, _ error)
- func (UnimplementedHandler) Queries(ctx context.Context, params QueriesParams) (r WorldObjects, _ error)
- func (UnimplementedHandler) Updates(ctx context.Context, params UpdatesParams) (r WorldObjects, _ error)
- type UpdatesParams
- type WorldObject
- func (s *WorldObject) Decode(d *jx.Decoder) error
- func (s *WorldObject) Encode(e *jx.Encoder)
- func (s *WorldObject) GetID() int64
- func (s *WorldObject) GetRandomNumber() int64
- func (s *WorldObject) MarshalJSON() ([]byte, error)
- func (s *WorldObject) SetFake()
- func (s *WorldObject) SetID(val int64)
- func (s *WorldObject) SetRandomNumber(val int64)
- func (s *WorldObject) UnmarshalJSON(data []byte) error
- type WorldObjects
Constants ¶
const ( WriterCtxKey = "writer" RequestCtxKey = "request" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CachingParams ¶
type CachingParams struct {
Count int64
}
CachingParams is parameters of Caching operation.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client implements OAS client.
func NewClient ¶
func NewClient(serverURL string, opts ...ClientOption) (*Client, error)
NewClient initializes new Client defined by OAS.
func (*Client) Caching ¶
func (c *Client) Caching(ctx context.Context, params CachingParams) (WorldObjects, error)
Caching invokes Caching operation.
Test #7. The Caching test exercises the preferred in-memory or separate-process caching technology for the platform or framework. For implementation simplicity, the requirements are very similar to the multiple database-query test Test #3, but use a separate database table. The requirements are quite generous, affording each framework fairly broad freedom to meet the requirements in the manner that best represents the canonical non-distributed caching approach for the framework. (Note: a distributed caching test type could be added later.).
GET /cached-worlds
func (*Client) DB ¶
func (c *Client) DB(ctx context.Context) (*WorldObject, error)
DB invokes DB operation.
Test #2. The Single Database Query test exercises the framework's object-relational mapper (ORM), random number generator, database driver, and database connection pool.
GET /db
func (*Client) JSON ¶
func (c *Client) JSON(ctx context.Context) (*HelloWorld, error)
JSON invokes json operation.
Test #1. The JSON Serialization test exercises the framework fundamentals including keep-alive support, request routing, request header parsing, object instantiation, JSON serialization, response header generation, and request count throughput.
GET /json
func (*Client) Queries ¶
func (c *Client) Queries(ctx context.Context, params QueriesParams) (WorldObjects, error)
Queries invokes Queries operation.
Test #3. The Multiple Database Queries test is a variation of Test #2 and also uses the World table. Multiple rows are fetched to more dramatically punish the database driver and connection pool. At the highest queries-per-request tested (20), this test demonstrates all frameworks' convergence toward zero requests-per-second as database activity increases.
GET /queries
func (*Client) Updates ¶
func (c *Client) Updates(ctx context.Context, params UpdatesParams) (WorldObjects, error)
Updates invokes Updates operation.
Test #5. The Database Updates test is a variation of Test #3 that exercises the ORM's persistence of objects and the database driver's performance at running UPDATE statements or similar. The spirit of this test is to exercise a variable number of read-then-write style database operations.
GET /updates
type ClientOption ¶
type ClientOption interface {
// contains filtered or unexported methods
}
ClientOption is client config option.
func WithClient ¶
func WithClient(client ht.Client) ClientOption
WithClient specifies http client to use.
type Handler ¶
type Handler interface { // Caching implements Caching operation. // // Test #7. The Caching test exercises the preferred in-memory or separate-process caching technology // for the platform or framework. For implementation simplicity, the requirements are very similar to // the multiple database-query test Test #3, but use a separate database table. The requirements are // quite generous, affording each framework fairly broad freedom to meet the requirements in the // manner that best represents the canonical non-distributed caching approach for the framework. // (Note: a distributed caching test type could be added later.). // // GET /cached-worlds Caching(ctx context.Context, params CachingParams) (WorldObjects, error) // DB implements DB operation. // // Test #2. The Single Database Query test exercises the framework's object-relational mapper (ORM), // random number generator, database driver, and database connection pool. // // GET /db DB(ctx context.Context) (*WorldObject, error) // JSON implements json operation. // // Test #1. The JSON Serialization test exercises the framework fundamentals including keep-alive // support, request routing, request header parsing, object instantiation, JSON serialization, // response header generation, and request count throughput. // // GET /json JSON(ctx context.Context) (*HelloWorld, error) // Queries implements Queries operation. // // Test #3. The Multiple Database Queries test is a variation of Test #2 and also uses the World // table. Multiple rows are fetched to more dramatically punish the database driver and connection // pool. At the highest queries-per-request tested (20), this test demonstrates all frameworks' // convergence toward zero requests-per-second as database activity increases. // // GET /queries Queries(ctx context.Context, params QueriesParams) (WorldObjects, error) // Updates implements Updates operation. // // Test #5. The Database Updates test is a variation of Test #3 that exercises the ORM's persistence // of objects and the database driver's performance at running UPDATE statements or similar. The // spirit of this test is to exercise a variable number of read-then-write style database operations. // // GET /updates Updates(ctx context.Context, params UpdatesParams) (WorldObjects, error) }
Handler handles operations described by OpenAPI v3 specification.
type HelloWorld ¶
type HelloWorld struct { // Should be equal to 'Hello, World!'. Message string `json:"message"` }
Ref: #/components/schemas/HelloWorld
func (*HelloWorld) Decode ¶
func (s *HelloWorld) Decode(d *jx.Decoder) error
Decode decodes HelloWorld from json.
func (*HelloWorld) Encode ¶
func (s *HelloWorld) Encode(e *jx.Encoder)
Encode implements json.Marshaler.
func (*HelloWorld) GetMessage ¶
func (s *HelloWorld) GetMessage() string
GetMessage returns the value of Message.
func (*HelloWorld) MarshalJSON ¶
func (s *HelloWorld) MarshalJSON() ([]byte, error)
MarshalJSON implements stdjson.Marshaler.
func (*HelloWorld) SetMessage ¶
func (s *HelloWorld) SetMessage(val string)
SetMessage sets the value of Message.
func (*HelloWorld) UnmarshalJSON ¶
func (s *HelloWorld) UnmarshalJSON(data []byte) error
UnmarshalJSON implements stdjson.Unmarshaler.
type Invoker ¶
type Invoker interface { // Caching invokes Caching operation. // // Test #7. The Caching test exercises the preferred in-memory or separate-process caching technology // for the platform or framework. For implementation simplicity, the requirements are very similar to // the multiple database-query test Test #3, but use a separate database table. The requirements are // quite generous, affording each framework fairly broad freedom to meet the requirements in the // manner that best represents the canonical non-distributed caching approach for the framework. // (Note: a distributed caching test type could be added later.). // // GET /cached-worlds Caching(ctx context.Context, params CachingParams) (WorldObjects, error) // DB invokes DB operation. // // Test #2. The Single Database Query test exercises the framework's object-relational mapper (ORM), // random number generator, database driver, and database connection pool. // // GET /db DB(ctx context.Context) (*WorldObject, error) // JSON invokes json operation. // // Test #1. The JSON Serialization test exercises the framework fundamentals including keep-alive // support, request routing, request header parsing, object instantiation, JSON serialization, // response header generation, and request count throughput. // // GET /json JSON(ctx context.Context) (*HelloWorld, error) // Queries invokes Queries operation. // // Test #3. The Multiple Database Queries test is a variation of Test #2 and also uses the World // table. Multiple rows are fetched to more dramatically punish the database driver and connection // pool. At the highest queries-per-request tested (20), this test demonstrates all frameworks' // convergence toward zero requests-per-second as database activity increases. // // GET /queries Queries(ctx context.Context, params QueriesParams) (WorldObjects, error) // Updates invokes Updates operation. // // Test #5. The Database Updates test is a variation of Test #3 that exercises the ORM's persistence // of objects and the database driver's performance at running UPDATE statements or similar. The // spirit of this test is to exercise a variable number of read-then-write style database operations. // // GET /updates Updates(ctx context.Context, params UpdatesParams) (WorldObjects, error) }
Invoker invokes operations described by OpenAPI v3 specification.
type Option ¶
type Option interface { ServerOption ClientOption }
Option is config option.
func WithMeterProvider ¶
func WithMeterProvider(provider metric.MeterProvider) Option
WithMeterProvider specifies a meter provider to use for creating a meter.
If none is specified, the otel.GetMeterProvider() is used.
func WithTracerProvider ¶
func WithTracerProvider(provider trace.TracerProvider) Option
WithTracerProvider specifies a tracer provider to use for creating a tracer.
If none is specified, the global provider is used.
type QueriesParams ¶
type QueriesParams struct {
Queries int64
}
QueriesParams is parameters of Queries operation.
type Route ¶
type Route struct {
// contains filtered or unexported fields
}
Route is route object.
func (Route) OperationID ¶
OperationID returns OpenAPI operationId.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server implements http server based on OpenAPI v3 specification and calls Handler to handle requests.
func NewServer ¶
func NewServer(h Handler, opts ...ServerOption) (*Server, error)
NewServer creates new Server.
type ServerOption ¶
type ServerOption interface {
// contains filtered or unexported methods
}
ServerOption is server config option.
func WithErrorHandler ¶
func WithErrorHandler(h ErrorHandler) ServerOption
WithErrorHandler specifies error handler to use.
func WithMaxMultipartMemory ¶
func WithMaxMultipartMemory(max int64) ServerOption
WithMaxMultipartMemory specifies limit of memory for storing file parts. File parts which can't be stored in memory will be stored on disk in temporary files.
func WithMethodNotAllowed ¶
func WithMethodNotAllowed(methodNotAllowed func(w http.ResponseWriter, r *http.Request, allowed string)) ServerOption
WithMethodNotAllowed specifies Method Not Allowed handler to use.
func WithMiddleware ¶
func WithMiddleware(m ...Middleware) ServerOption
WithMiddleware specifies middlewares to use.
func WithNotFound ¶
func WithNotFound(notFound http.HandlerFunc) ServerOption
WithNotFound specifies Not Found handler to use.
func WithPathPrefix ¶
func WithPathPrefix(prefix string) ServerOption
WithPathPrefix specifies server path prefix.
type UnimplementedHandler ¶
type UnimplementedHandler struct{}
UnimplementedHandler is no-op Handler which returns http.ErrNotImplemented.
func (UnimplementedHandler) Caching ¶
func (UnimplementedHandler) Caching(ctx context.Context, params CachingParams) (r WorldObjects, _ error)
Caching implements Caching operation.
Test #7. The Caching test exercises the preferred in-memory or separate-process caching technology for the platform or framework. For implementation simplicity, the requirements are very similar to the multiple database-query test Test #3, but use a separate database table. The requirements are quite generous, affording each framework fairly broad freedom to meet the requirements in the manner that best represents the canonical non-distributed caching approach for the framework. (Note: a distributed caching test type could be added later.).
GET /cached-worlds
func (UnimplementedHandler) DB ¶
func (UnimplementedHandler) DB(ctx context.Context) (r *WorldObject, _ error)
DB implements DB operation.
Test #2. The Single Database Query test exercises the framework's object-relational mapper (ORM), random number generator, database driver, and database connection pool.
GET /db
func (UnimplementedHandler) JSON ¶
func (UnimplementedHandler) JSON(ctx context.Context) (r *HelloWorld, _ error)
JSON implements json operation.
Test #1. The JSON Serialization test exercises the framework fundamentals including keep-alive support, request routing, request header parsing, object instantiation, JSON serialization, response header generation, and request count throughput.
GET /json
func (UnimplementedHandler) Queries ¶
func (UnimplementedHandler) Queries(ctx context.Context, params QueriesParams) (r WorldObjects, _ error)
Queries implements Queries operation.
Test #3. The Multiple Database Queries test is a variation of Test #2 and also uses the World table. Multiple rows are fetched to more dramatically punish the database driver and connection pool. At the highest queries-per-request tested (20), this test demonstrates all frameworks' convergence toward zero requests-per-second as database activity increases.
GET /queries
func (UnimplementedHandler) Updates ¶
func (UnimplementedHandler) Updates(ctx context.Context, params UpdatesParams) (r WorldObjects, _ error)
Updates implements Updates operation.
Test #5. The Database Updates test is a variation of Test #3 that exercises the ORM's persistence of objects and the database driver's performance at running UPDATE statements or similar. The spirit of this test is to exercise a variable number of read-then-write style database operations.
GET /updates
type UpdatesParams ¶
type UpdatesParams struct {
Queries int64
}
UpdatesParams is parameters of Updates operation.
type WorldObject ¶
Ref: #/components/schemas/WorldObject
func (*WorldObject) Decode ¶
func (s *WorldObject) Decode(d *jx.Decoder) error
Decode decodes WorldObject from json.
func (*WorldObject) Encode ¶
func (s *WorldObject) Encode(e *jx.Encoder)
Encode implements json.Marshaler.
func (*WorldObject) GetRandomNumber ¶
func (s *WorldObject) GetRandomNumber() int64
GetRandomNumber returns the value of RandomNumber.
func (*WorldObject) MarshalJSON ¶
func (s *WorldObject) MarshalJSON() ([]byte, error)
MarshalJSON implements stdjson.Marshaler.
func (*WorldObject) SetRandomNumber ¶
func (s *WorldObject) SetRandomNumber(val int64)
SetRandomNumber sets the value of RandomNumber.
func (*WorldObject) UnmarshalJSON ¶
func (s *WorldObject) UnmarshalJSON(data []byte) error
UnmarshalJSON implements stdjson.Unmarshaler.
type WorldObjects ¶
type WorldObjects []WorldObject
func (*WorldObjects) Decode ¶
func (s *WorldObjects) Decode(d *jx.Decoder) error
Decode decodes WorldObjects from json.
func (WorldObjects) Encode ¶
func (s WorldObjects) Encode(e *jx.Encoder)
Encode encodes WorldObjects as json.
func (WorldObjects) MarshalJSON ¶
func (s WorldObjects) MarshalJSON() ([]byte, error)
MarshalJSON implements stdjson.Marshaler.
func (*WorldObjects) UnmarshalJSON ¶
func (s *WorldObjects) UnmarshalJSON(data []byte) error
UnmarshalJSON implements stdjson.Unmarshaler.
func (WorldObjects) Validate ¶
func (s WorldObjects) Validate() error
Source Files ¶
- oas_cfg_gen.go
- oas_client_gen.go
- oas_defaults_gen.go
- oas_faker_gen.go
- oas_handlers_gen.go
- oas_json_gen.go
- oas_middleware_gen.go
- oas_parameters_gen.go
- oas_request_decoders_gen.go
- oas_request_encoders_gen.go
- oas_response_decoders_gen.go
- oas_response_encoders_gen.go
- oas_router_gen.go
- oas_schemas_gen.go
- oas_server_gen.go
- oas_unimplemented_gen.go
- oas_validators_gen.go