Documentation ¶
Index ¶
- func WithServerURL(ctx context.Context, u *url.URL) context.Context
- type Client
- type ClientOption
- type DefaultOK
- func (s *DefaultOK) Decode(d *jx.Decoder) error
- func (s *DefaultOK) Encode(e *jx.Encoder)
- func (s *DefaultOK) GetDate() OptDate
- func (s *DefaultOK) GetDateTime() OptDateTime
- func (s *DefaultOK) GetTime() OptTime
- func (s *DefaultOK) MarshalJSON() ([]byte, error)
- func (s *DefaultOK) SetDate(val OptDate)
- func (s *DefaultOK) SetDateTime(val OptDateTime)
- func (s *DefaultOK) SetTime(val OptTime)
- func (s *DefaultOK) UnmarshalJSON(data []byte) error
- type DefaultParams
- type ErrorHandler
- type Handler
- type Invoker
- type Labeler
- type Middleware
- type OperationName
- type OptDate
- func (o *OptDate) Decode(d *jx.Decoder, format func(*jx.Decoder) (time.Time, error)) error
- func (o OptDate) Encode(e *jx.Encoder, format func(*jx.Encoder, time.Time))
- func (o OptDate) Get() (v time.Time, ok bool)
- func (o OptDate) IsSet() bool
- func (s OptDate) MarshalJSON() ([]byte, error)
- func (o OptDate) Or(d time.Time) time.Time
- func (o *OptDate) Reset()
- func (o *OptDate) SetTo(v time.Time)
- func (s *OptDate) UnmarshalJSON(data []byte) error
- type OptDateTime
- func (o *OptDateTime) Decode(d *jx.Decoder, format func(*jx.Decoder) (time.Time, error)) error
- func (o OptDateTime) Encode(e *jx.Encoder, format func(*jx.Encoder, time.Time))
- func (o OptDateTime) Get() (v time.Time, ok bool)
- func (o OptDateTime) IsSet() bool
- func (s OptDateTime) MarshalJSON() ([]byte, error)
- func (o OptDateTime) Or(d time.Time) time.Time
- func (o *OptDateTime) Reset()
- func (o *OptDateTime) SetTo(v time.Time)
- func (s *OptDateTime) UnmarshalJSON(data []byte) error
- type OptTime
- func (o *OptTime) Decode(d *jx.Decoder, format func(*jx.Decoder) (time.Time, error)) error
- func (o OptTime) Encode(e *jx.Encoder, format func(*jx.Encoder, time.Time))
- func (o OptTime) Get() (v time.Time, ok bool)
- func (o OptTime) IsSet() bool
- func (s OptTime) MarshalJSON() ([]byte, error)
- func (o OptTime) Or(d time.Time) time.Time
- func (o *OptTime) Reset()
- func (o *OptTime) SetTo(v time.Time)
- func (s *OptTime) UnmarshalJSON(data []byte) error
- type Option
- type RequiredOK
- func (s *RequiredOK) Decode(d *jx.Decoder) error
- func (s *RequiredOK) Encode(e *jx.Encoder)
- func (s *RequiredOK) GetDate() time.Time
- func (s *RequiredOK) GetDateTime() time.Time
- func (s *RequiredOK) GetTime() time.Time
- func (s *RequiredOK) MarshalJSON() ([]byte, error)
- func (s *RequiredOK) SetDate(val time.Time)
- func (s *RequiredOK) SetDateTime(val time.Time)
- func (s *RequiredOK) SetTime(val time.Time)
- func (s *RequiredOK) UnmarshalJSON(data []byte) error
- type RequiredParams
- 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
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
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) Required ¶
func (c *Client) Required(ctx context.Context, params RequiredParams) (*RequiredOK, error)
Required invokes required operation.
GET /required
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 DefaultOK ¶
type DefaultOK struct { Date OptDate `json:"date"` Time OptTime `json:"time"` DateTime OptDateTime `json:"dateTime"` }
func (*DefaultOK) GetDateTime ¶
func (s *DefaultOK) GetDateTime() OptDateTime
GetDateTime returns the value of DateTime.
func (*DefaultOK) MarshalJSON ¶
MarshalJSON implements stdjson.Marshaler.
func (*DefaultOK) SetDateTime ¶
func (s *DefaultOK) SetDateTime(val OptDateTime)
SetDateTime sets the value of DateTime.
func (*DefaultOK) UnmarshalJSON ¶
UnmarshalJSON implements stdjson.Unmarshaler.
type DefaultParams ¶
type DefaultParams struct { Date OptDate Time OptTime DateTime OptDateTime }
DefaultParams is parameters of default operation.
type Handler ¶
type Handler interface { // Default implements default operation. // // GET /optional Default(ctx context.Context, params DefaultParams) (*DefaultOK, error) // Required implements required operation. // // GET /required Required(ctx context.Context, params RequiredParams) (*RequiredOK, error) }
Handler handles operations described by OpenAPI v3 specification.
type Invoker ¶
type Invoker interface { // Default invokes default operation. // // GET /optional Default(ctx context.Context, params DefaultParams) (*DefaultOK, error) // Required invokes required operation. // // GET /required Required(ctx context.Context, params RequiredParams) (*RequiredOK, error) }
Invoker invokes operations described by OpenAPI v3 specification.
type Labeler ¶
type Labeler struct {
// contains filtered or unexported fields
}
Labeler is used to allow adding custom attributes to the server request metrics.
func LabelerFromContext ¶
LabelerFromContext retrieves the Labeler from the provided context, if present.
If no Labeler was found in the provided context a new, empty Labeler is returned and the second return value is false. In this case it is safe to use the Labeler but any attributes added to it will not be used.
func (*Labeler) AttributeSet ¶
AttributeSet returns the attributes added to the Labeler as an attribute.Set.
type OperationName ¶ added in v1.7.0
type OperationName = string
OperationName is the ogen operation name
const ( DefaultOperation OperationName = "Default" RequiredOperation OperationName = "Required" )
type OptDate ¶
OptDate is optional time.Time.
func NewOptDate ¶
NewOptDate returns new OptDate with value set to v.
func (OptDate) MarshalJSON ¶
MarshalJSON implements stdjson.Marshaler.
func (*OptDate) UnmarshalJSON ¶
UnmarshalJSON implements stdjson.Unmarshaler.
type OptDateTime ¶
OptDateTime is optional time.Time.
func NewOptDateTime ¶
func NewOptDateTime(v time.Time) OptDateTime
NewOptDateTime returns new OptDateTime with value set to v.
func (OptDateTime) Get ¶
func (o OptDateTime) Get() (v time.Time, ok bool)
Get returns value and boolean that denotes whether value was set.
func (OptDateTime) IsSet ¶
func (o OptDateTime) IsSet() bool
IsSet returns true if OptDateTime was set.
func (OptDateTime) MarshalJSON ¶
func (s OptDateTime) MarshalJSON() ([]byte, error)
MarshalJSON implements stdjson.Marshaler.
func (OptDateTime) Or ¶
func (o OptDateTime) Or(d time.Time) time.Time
Or returns value if set, or given parameter if does not.
func (*OptDateTime) UnmarshalJSON ¶
func (s *OptDateTime) UnmarshalJSON(data []byte) error
UnmarshalJSON implements stdjson.Unmarshaler.
type OptTime ¶
OptTime is optional time.Time.
func NewOptTime ¶
NewOptTime returns new OptTime with value set to v.
func (OptTime) MarshalJSON ¶
MarshalJSON implements stdjson.Marshaler.
func (*OptTime) UnmarshalJSON ¶
UnmarshalJSON implements stdjson.Unmarshaler.
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 RequiredOK ¶
type RequiredOK struct { Date time.Time `json:"date"` Time time.Time `json:"time"` DateTime time.Time `json:"dateTime"` }
func (*RequiredOK) Decode ¶
func (s *RequiredOK) Decode(d *jx.Decoder) error
Decode decodes RequiredOK from json.
func (*RequiredOK) Encode ¶
func (s *RequiredOK) Encode(e *jx.Encoder)
Encode implements json.Marshaler.
func (*RequiredOK) GetDate ¶
func (s *RequiredOK) GetDate() time.Time
GetDate returns the value of Date.
func (*RequiredOK) GetDateTime ¶
func (s *RequiredOK) GetDateTime() time.Time
GetDateTime returns the value of DateTime.
func (*RequiredOK) GetTime ¶
func (s *RequiredOK) GetTime() time.Time
GetTime returns the value of Time.
func (*RequiredOK) MarshalJSON ¶
func (s *RequiredOK) MarshalJSON() ([]byte, error)
MarshalJSON implements stdjson.Marshaler.
func (*RequiredOK) SetDate ¶
func (s *RequiredOK) SetDate(val time.Time)
SetDate sets the value of Date.
func (*RequiredOK) SetDateTime ¶
func (s *RequiredOK) SetDateTime(val time.Time)
SetDateTime sets the value of DateTime.
func (*RequiredOK) SetTime ¶
func (s *RequiredOK) SetTime(val time.Time)
SetTime sets the value of Time.
func (*RequiredOK) UnmarshalJSON ¶
func (s *RequiredOK) UnmarshalJSON(data []byte) error
UnmarshalJSON implements stdjson.Unmarshaler.
type RequiredParams ¶
RequiredParams is parameters of required 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) Default ¶
func (UnimplementedHandler) Default(ctx context.Context, params DefaultParams) (r *DefaultOK, _ error)
Default implements default operation.
GET /optional
func (UnimplementedHandler) Required ¶
func (UnimplementedHandler) Required(ctx context.Context, params RequiredParams) (r *RequiredOK, _ error)
Required implements required operation.
GET /required
Source Files ¶
- oas_cfg_gen.go
- oas_client_gen.go
- oas_defaults_gen.go
- oas_handlers_gen.go
- oas_json_gen.go
- oas_labeler_gen.go
- oas_middleware_gen.go
- oas_operations_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