Documentation ¶
Index ¶
- func WithServerURL(ctx context.Context, u *url.URL) context.Context
- type Client
- type ClientOption
- type ErrorHandler
- type GetKeyboardParams
- type Handler
- type Keyboard
- func (s *Keyboard) Decode(d *jx.Decoder) error
- func (s *Keyboard) Encode(e *jx.Encoder)
- func (s *Keyboard) GetDiscount() NilInt64
- func (s *Keyboard) GetID() int64
- func (s *Keyboard) GetKeycaps() Keycaps
- func (s *Keyboard) GetName() string
- func (s *Keyboard) GetPrice() int64
- func (s *Keyboard) GetSwitches() Switches
- func (s *Keyboard) MarshalJSON() ([]byte, error)
- func (s *Keyboard) SetDiscount(val NilInt64)
- func (s *Keyboard) SetID(val int64)
- func (s *Keyboard) SetKeycaps(val Keycaps)
- func (s *Keyboard) SetName(val string)
- func (s *Keyboard) SetPrice(val int64)
- func (s *Keyboard) SetSwitches(val Switches)
- func (s *Keyboard) UnmarshalJSON(data []byte) error
- func (s *Keyboard) Validate() error
- type Keycaps
- func (s *Keycaps) Decode(d *jx.Decoder) error
- func (s *Keycaps) Encode(e *jx.Encoder)
- func (s *Keycaps) GetID() int64
- func (s *Keycaps) GetMaterial() KeycapsMaterial
- func (s *Keycaps) GetName() string
- func (s *Keycaps) GetProfile() string
- func (s *Keycaps) MarshalJSON() ([]byte, error)
- func (s *Keycaps) SetID(val int64)
- func (s *Keycaps) SetMaterial(val KeycapsMaterial)
- func (s *Keycaps) SetName(val string)
- func (s *Keycaps) SetProfile(val string)
- func (s *Keycaps) UnmarshalJSON(data []byte) error
- func (s *Keycaps) Validate() error
- type KeycapsMaterial
- func (s *KeycapsMaterial) Decode(d *jx.Decoder) error
- func (s KeycapsMaterial) Encode(e *jx.Encoder)
- func (s KeycapsMaterial) MarshalJSON() ([]byte, error)
- func (s KeycapsMaterial) MarshalText() ([]byte, error)
- func (s *KeycapsMaterial) UnmarshalJSON(data []byte) error
- func (s *KeycapsMaterial) UnmarshalText(data []byte) error
- func (s KeycapsMaterial) Validate() error
- type Middleware
- type NilInt64
- func (o *NilInt64) Decode(d *jx.Decoder) error
- func (o NilInt64) Encode(e *jx.Encoder)
- func (o NilInt64) Get() (v int64, ok bool)
- func (o NilInt64) IsNull() bool
- func (s NilInt64) MarshalJSON() ([]byte, error)
- func (o NilInt64) Or(d int64) int64
- func (o *NilInt64) SetTo(v int64)
- func (o *NilInt64) SetToNull()
- func (s *NilInt64) UnmarshalJSON(data []byte) error
- type Option
- 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 Switches
- func (s *Switches) Decode(d *jx.Decoder) error
- func (s *Switches) Encode(e *jx.Encoder)
- func (s *Switches) GetID() int64
- func (s *Switches) GetName() string
- func (s *Switches) GetSwitchType() SwitchesSwitchType
- func (s *Switches) MarshalJSON() ([]byte, error)
- func (s *Switches) SetID(val int64)
- func (s *Switches) SetName(val string)
- func (s *Switches) SetSwitchType(val SwitchesSwitchType)
- func (s *Switches) UnmarshalJSON(data []byte) error
- func (s *Switches) Validate() error
- type SwitchesSwitchType
- func (s *SwitchesSwitchType) Decode(d *jx.Decoder) error
- func (s SwitchesSwitchType) Encode(e *jx.Encoder)
- func (s SwitchesSwitchType) MarshalJSON() ([]byte, error)
- func (s SwitchesSwitchType) MarshalText() ([]byte, error)
- func (s *SwitchesSwitchType) UnmarshalJSON(data []byte) error
- func (s *SwitchesSwitchType) UnmarshalText(data []byte) error
- func (s SwitchesSwitchType) Validate() error
- 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.
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 GetKeyboardParams ¶
type GetKeyboardParams struct {
ID int64
}
GetKeyboardParams is parameters of getKeyboard operation.
type Handler ¶
type Handler interface { // GetKeyboard implements getKeyboard operation. // // GET /keyboard/{id} GetKeyboard(ctx context.Context, params GetKeyboardParams) (*Keyboard, error) }
Handler handles operations described by OpenAPI v3 specification.
type Keyboard ¶
type Keyboard struct { ID int64 `json:"id"` Name string `json:"name"` Switches Switches `json:"switches"` Keycaps Keycaps `json:"keycaps"` Price int64 `json:"price"` Discount NilInt64 `json:"discount"` }
Ref: #/components/schemas/Keyboard
func (*Keyboard) GetDiscount ¶
GetDiscount returns the value of Discount.
func (*Keyboard) GetKeycaps ¶
GetKeycaps returns the value of Keycaps.
func (*Keyboard) GetSwitches ¶
GetSwitches returns the value of Switches.
func (*Keyboard) MarshalJSON ¶
MarshalJSON implements stdjson.Marshaler.
func (*Keyboard) SetDiscount ¶
SetDiscount sets the value of Discount.
func (*Keyboard) SetKeycaps ¶
SetKeycaps sets the value of Keycaps.
func (*Keyboard) SetSwitches ¶
SetSwitches sets the value of Switches.
func (*Keyboard) UnmarshalJSON ¶
UnmarshalJSON implements stdjson.Unmarshaler.
type Keycaps ¶
type Keycaps struct { ID int64 `json:"id"` Name string `json:"name"` Profile string `json:"profile"` Material KeycapsMaterial `json:"material"` }
Ref: #/components/schemas/Keycaps
func (*Keycaps) GetMaterial ¶
func (s *Keycaps) GetMaterial() KeycapsMaterial
GetMaterial returns the value of Material.
func (*Keycaps) GetProfile ¶
GetProfile returns the value of Profile.
func (*Keycaps) MarshalJSON ¶
MarshalJSON implements stdjson.Marshaler.
func (*Keycaps) SetMaterial ¶
func (s *Keycaps) SetMaterial(val KeycapsMaterial)
SetMaterial sets the value of Material.
func (*Keycaps) SetProfile ¶
SetProfile sets the value of Profile.
func (*Keycaps) UnmarshalJSON ¶
UnmarshalJSON implements stdjson.Unmarshaler.
type KeycapsMaterial ¶
type KeycapsMaterial string
const ( KeycapsMaterialABS KeycapsMaterial = "ABS" KeycapsMaterialPBT KeycapsMaterial = "PBT" )
func (*KeycapsMaterial) Decode ¶
func (s *KeycapsMaterial) Decode(d *jx.Decoder) error
Decode decodes KeycapsMaterial from json.
func (KeycapsMaterial) Encode ¶
func (s KeycapsMaterial) Encode(e *jx.Encoder)
Encode encodes KeycapsMaterial as json.
func (KeycapsMaterial) MarshalJSON ¶
func (s KeycapsMaterial) MarshalJSON() ([]byte, error)
MarshalJSON implements stdjson.Marshaler.
func (KeycapsMaterial) MarshalText ¶
func (s KeycapsMaterial) MarshalText() ([]byte, error)
MarshalText implements encoding.TextMarshaler.
func (*KeycapsMaterial) UnmarshalJSON ¶
func (s *KeycapsMaterial) UnmarshalJSON(data []byte) error
UnmarshalJSON implements stdjson.Unmarshaler.
func (*KeycapsMaterial) UnmarshalText ¶
func (s *KeycapsMaterial) UnmarshalText(data []byte) error
UnmarshalText implements encoding.TextUnmarshaler.
func (KeycapsMaterial) Validate ¶
func (s KeycapsMaterial) Validate() error
type NilInt64 ¶
NilInt64 is nullable int64.
func NewNilInt64 ¶
NewNilInt64 returns new NilInt64 with value set to v.
func (NilInt64) MarshalJSON ¶
MarshalJSON implements stdjson.Marshaler.
func (*NilInt64) 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 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 Switches ¶
type Switches struct { ID int64 `json:"id"` Name string `json:"name"` SwitchType SwitchesSwitchType `json:"switch_type"` }
Ref: #/components/schemas/Switches
func (*Switches) GetSwitchType ¶
func (s *Switches) GetSwitchType() SwitchesSwitchType
GetSwitchType returns the value of SwitchType.
func (*Switches) MarshalJSON ¶
MarshalJSON implements stdjson.Marshaler.
func (*Switches) SetSwitchType ¶
func (s *Switches) SetSwitchType(val SwitchesSwitchType)
SetSwitchType sets the value of SwitchType.
func (*Switches) UnmarshalJSON ¶
UnmarshalJSON implements stdjson.Unmarshaler.
type SwitchesSwitchType ¶
type SwitchesSwitchType string
const ( SwitchesSwitchTypeMechanical SwitchesSwitchType = "mechanical" SwitchesSwitchTypeOptical SwitchesSwitchType = "optical" SwitchesSwitchTypeElectrocapacitive SwitchesSwitchType = "electrocapacitive" )
func (*SwitchesSwitchType) Decode ¶
func (s *SwitchesSwitchType) Decode(d *jx.Decoder) error
Decode decodes SwitchesSwitchType from json.
func (SwitchesSwitchType) Encode ¶
func (s SwitchesSwitchType) Encode(e *jx.Encoder)
Encode encodes SwitchesSwitchType as json.
func (SwitchesSwitchType) MarshalJSON ¶
func (s SwitchesSwitchType) MarshalJSON() ([]byte, error)
MarshalJSON implements stdjson.Marshaler.
func (SwitchesSwitchType) MarshalText ¶
func (s SwitchesSwitchType) MarshalText() ([]byte, error)
MarshalText implements encoding.TextMarshaler.
func (*SwitchesSwitchType) UnmarshalJSON ¶
func (s *SwitchesSwitchType) UnmarshalJSON(data []byte) error
UnmarshalJSON implements stdjson.Unmarshaler.
func (*SwitchesSwitchType) UnmarshalText ¶
func (s *SwitchesSwitchType) UnmarshalText(data []byte) error
UnmarshalText implements encoding.TextUnmarshaler.
func (SwitchesSwitchType) Validate ¶
func (s SwitchesSwitchType) Validate() error
type UnimplementedHandler ¶
type UnimplementedHandler struct{}
UnimplementedHandler is no-op Handler which returns http.ErrNotImplemented.
func (UnimplementedHandler) GetKeyboard ¶
func (UnimplementedHandler) GetKeyboard(ctx context.Context, params GetKeyboardParams) (r *Keyboard, _ error)
GetKeyboard implements getKeyboard operation.
GET /keyboard/{id}
Source Files ¶
- oas_cfg_gen.go
- oas_client_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