Documentation ¶
Index ¶
- func WithServerURL(ctx context.Context, u *url.URL) context.Context
- type Client
- type ClientOption
- type Error
- type ErrorHandler
- type ErrorStatusCode
- type Handler
- type Job
- func (s *Job) Decode(d *jx.Decoder) error
- func (s Job) Encode(e *jx.Encoder)
- func (s Job) GetJobDownload() (v JobDownload, ok bool)
- func (s Job) GetJobNothing() (v JobNothing, ok bool)
- func (s Job) GetJobProcess() (v JobProcess, ok bool)
- func (s Job) IsJobDownload() bool
- func (s Job) IsJobNothing() bool
- func (s Job) IsJobProcess() bool
- func (s Job) MarshalJSON() ([]byte, error)
- func (s *Job) SetJobDownload(v JobDownload)
- func (s *Job) SetJobNothing(v JobNothing)
- func (s *Job) SetJobProcess(v JobProcess)
- func (s *Job) UnmarshalJSON(data []byte) error
- func (s Job) Validate() error
- type JobDownload
- type JobNothing
- type JobProcess
- func (s *JobProcess) Decode(d *jx.Decoder) error
- func (s *JobProcess) Encode(e *jx.Encoder)
- func (s *JobProcess) GetClickhouse() string
- func (s *JobProcess) GetKeys() []string
- func (s *JobProcess) MarshalJSON() ([]byte, error)
- func (s *JobProcess) SetClickhouse(val string)
- func (s *JobProcess) SetKeys(val []string)
- func (s *JobProcess) UnmarshalJSON(data []byte) error
- func (s *JobProcess) Validate() error
- type JobType
- type Middleware
- type OptInt64
- func (o *OptInt64) Decode(d *jx.Decoder) error
- func (o OptInt64) Encode(e *jx.Encoder)
- func (o OptInt64) Get() (v int64, ok bool)
- func (o OptInt64) IsSet() bool
- func (s OptInt64) MarshalJSON() ([]byte, error)
- func (o OptInt64) Or(d int64) int64
- func (o *OptInt64) Reset()
- func (o *OptInt64) SetTo(v int64)
- func (s *OptInt64) UnmarshalJSON(data []byte) error
- type OptString
- func (o *OptString) Decode(d *jx.Decoder) error
- func (o OptString) Encode(e *jx.Encoder)
- func (o OptString) Get() (v string, ok bool)
- func (o OptString) IsSet() bool
- func (s OptString) MarshalJSON() ([]byte, error)
- func (o OptString) Or(d string) string
- func (o *OptString) Reset()
- func (o *OptString) SetTo(v string)
- func (s *OptString) UnmarshalJSON(data []byte) error
- type Option
- type PollParams
- type Progress
- func (s *Progress) Decode(d *jx.Decoder) error
- func (s *Progress) Encode(e *jx.Encoder)
- func (s *Progress) GetContentSizeBytes() OptInt64
- func (s *Progress) GetEvent() ProgressEvent
- func (s *Progress) GetInputReadyBytes() OptInt64
- func (s *Progress) GetInputSizeBytes() OptInt64
- func (s *Progress) GetKey() string
- func (s *Progress) GetOutputSizeBytes() OptInt64
- func (s *Progress) GetSHA256Content() OptString
- func (s *Progress) GetSHA256Input() OptString
- func (s *Progress) GetSHA256Output() OptString
- func (s *Progress) MarshalJSON() ([]byte, error)
- func (s *Progress) SetContentSizeBytes(val OptInt64)
- func (s *Progress) SetEvent(val ProgressEvent)
- func (s *Progress) SetInputReadyBytes(val OptInt64)
- func (s *Progress) SetInputSizeBytes(val OptInt64)
- func (s *Progress) SetKey(val string)
- func (s *Progress) SetOutputSizeBytes(val OptInt64)
- func (s *Progress) SetSHA256Content(val OptString)
- func (s *Progress) SetSHA256Input(val OptString)
- func (s *Progress) SetSHA256Output(val OptString)
- func (s *Progress) UnmarshalJSON(data []byte) error
- func (s *Progress) Validate() error
- type ProgressEvent
- func (s *ProgressEvent) Decode(d *jx.Decoder) error
- func (s ProgressEvent) Encode(e *jx.Encoder)
- func (s ProgressEvent) MarshalJSON() ([]byte, error)
- func (s ProgressEvent) MarshalText() ([]byte, error)
- func (s *ProgressEvent) UnmarshalJSON(data []byte) error
- func (s *ProgressEvent) UnmarshalText(data []byte) error
- func (s ProgressEvent) Validate() error
- type ProgressParams
- 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 Status
- type UnimplementedHandler
- func (UnimplementedHandler) NewError(ctx context.Context, err error) (r *ErrorStatusCode)
- func (UnimplementedHandler) Poll(ctx context.Context, params PollParams) (r Job, _ error)
- func (UnimplementedHandler) Progress(ctx context.Context, req *Progress, params ProgressParams) (r *Status, _ error)
- func (UnimplementedHandler) Status(ctx context.Context) (r *Status, _ error)
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 ¶ added in v0.2.0
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 Error ¶
type Error struct {
Message string `json:"message"`
}
Error description. Ref: #/components/schemas/Error
func (*Error) GetMessage ¶ added in v0.2.0
GetMessage returns the value of Message.
func (*Error) MarshalJSON ¶ added in v0.2.0
MarshalJSON implements stdjson.Marshaler.
func (*Error) SetMessage ¶ added in v0.2.0
SetMessage sets the value of Message.
func (*Error) UnmarshalJSON ¶ added in v0.2.0
UnmarshalJSON implements stdjson.Unmarshaler.
type ErrorHandler ¶ added in v0.2.0
type ErrorHandler = ogenerrors.ErrorHandler
ErrorHandler is error handler.
type ErrorStatusCode ¶
ErrorStatusCode wraps Error with StatusCode.
func (*ErrorStatusCode) Error ¶
func (s *ErrorStatusCode) Error() string
func (*ErrorStatusCode) GetResponse ¶ added in v0.2.0
func (s *ErrorStatusCode) GetResponse() Error
GetResponse returns the value of Response.
func (*ErrorStatusCode) GetStatusCode ¶ added in v0.2.0
func (s *ErrorStatusCode) GetStatusCode() int
GetStatusCode returns the value of StatusCode.
func (*ErrorStatusCode) SetResponse ¶ added in v0.2.0
func (s *ErrorStatusCode) SetResponse(val Error)
SetResponse sets the value of Response.
func (*ErrorStatusCode) SetStatusCode ¶ added in v0.2.0
func (s *ErrorStatusCode) SetStatusCode(val int)
SetStatusCode sets the value of StatusCode.
type Handler ¶
type Handler interface { // Poll implements poll operation. // // Request job from coordinator. // // POST /job/poll Poll(ctx context.Context, params PollParams) (Job, error) // Progress implements progress operation. // // Report progress. // // POST /progress Progress(ctx context.Context, req *Progress, params ProgressParams) (*Status, error) // Status implements status operation. // // Get status. // // GET /status Status(ctx context.Context) (*Status, error) // NewError creates *ErrorStatusCode from error returned by handler. // // Used for common default response. NewError(ctx context.Context, err error) *ErrorStatusCode }
Handler handles operations described by OpenAPI v3 specification.
type Job ¶
type Job struct { Type JobType // switch on this field JobNothing JobNothing JobDownload JobDownload JobProcess JobProcess }
Job to perform on worker. Ref: #/components/schemas/Job Job represents sum type.
func NewJobDownloadJob ¶
func NewJobDownloadJob(v JobDownload) Job
NewJobDownloadJob returns new Job from JobDownload.
func NewJobNothingJob ¶
func NewJobNothingJob(v JobNothing) Job
NewJobNothingJob returns new Job from JobNothing.
func NewJobProcessJob ¶ added in v0.2.0
func NewJobProcessJob(v JobProcess) Job
NewJobProcessJob returns new Job from JobProcess.
func (Job) GetJobDownload ¶
func (s Job) GetJobDownload() (v JobDownload, ok bool)
GetJobDownload returns JobDownload and true boolean if Job is JobDownload.
func (Job) GetJobNothing ¶
func (s Job) GetJobNothing() (v JobNothing, ok bool)
GetJobNothing returns JobNothing and true boolean if Job is JobNothing.
func (Job) GetJobProcess ¶ added in v0.2.0
func (s Job) GetJobProcess() (v JobProcess, ok bool)
GetJobProcess returns JobProcess and true boolean if Job is JobProcess.
func (Job) IsJobDownload ¶
IsJobDownload reports whether Job is JobDownload.
func (Job) IsJobNothing ¶
IsJobNothing reports whether Job is JobNothing.
func (Job) IsJobProcess ¶ added in v0.2.0
IsJobProcess reports whether Job is JobProcess.
func (Job) MarshalJSON ¶ added in v0.2.0
MarshalJSON implements stdjson.Marshaler.
func (*Job) SetJobDownload ¶
func (s *Job) SetJobDownload(v JobDownload)
SetJobDownload sets Job to JobDownload.
func (*Job) SetJobNothing ¶
func (s *Job) SetJobNothing(v JobNothing)
SetJobNothing sets Job to JobNothing.
func (*Job) SetJobProcess ¶ added in v0.2.0
func (s *Job) SetJobProcess(v JobProcess)
SetJobProcess sets Job to JobProcess.
func (*Job) UnmarshalJSON ¶ added in v0.2.0
UnmarshalJSON implements stdjson.Unmarshaler.
type JobDownload ¶
type JobDownload struct {
Date string `json:"date"`
}
Download chunk. Ref: #/components/schemas/JobDownload
func (*JobDownload) Decode ¶
func (s *JobDownload) Decode(d *jx.Decoder) error
Decode decodes JobDownload from json.
func (*JobDownload) Encode ¶
func (s *JobDownload) Encode(e *jx.Encoder)
Encode implements json.Marshaler.
func (*JobDownload) GetDate ¶ added in v0.2.0
func (s *JobDownload) GetDate() string
GetDate returns the value of Date.
func (*JobDownload) MarshalJSON ¶ added in v0.2.0
func (s *JobDownload) MarshalJSON() ([]byte, error)
MarshalJSON implements stdjson.Marshaler.
func (*JobDownload) SetDate ¶ added in v0.2.0
func (s *JobDownload) SetDate(val string)
SetDate sets the value of Date.
func (*JobDownload) UnmarshalJSON ¶ added in v0.2.0
func (s *JobDownload) UnmarshalJSON(data []byte) error
UnmarshalJSON implements stdjson.Unmarshaler.
type JobNothing ¶
type JobNothing struct{}
Do nothing. Ref: #/components/schemas/JobNothing
func (*JobNothing) Decode ¶
func (s *JobNothing) Decode(d *jx.Decoder) error
Decode decodes JobNothing from json.
func (*JobNothing) Encode ¶
func (s *JobNothing) Encode(e *jx.Encoder)
Encode implements json.Marshaler.
func (*JobNothing) MarshalJSON ¶ added in v0.2.0
func (s *JobNothing) MarshalJSON() ([]byte, error)
MarshalJSON implements stdjson.Marshaler.
func (*JobNothing) UnmarshalJSON ¶ added in v0.2.0
func (s *JobNothing) UnmarshalJSON(data []byte) error
UnmarshalJSON implements stdjson.Unmarshaler.
type JobProcess ¶ added in v0.2.0
Process job. Ref: #/components/schemas/JobProcess
func (*JobProcess) Decode ¶ added in v0.2.0
func (s *JobProcess) Decode(d *jx.Decoder) error
Decode decodes JobProcess from json.
func (*JobProcess) Encode ¶ added in v0.2.0
func (s *JobProcess) Encode(e *jx.Encoder)
Encode implements json.Marshaler.
func (*JobProcess) GetClickhouse ¶ added in v0.2.0
func (s *JobProcess) GetClickhouse() string
GetClickhouse returns the value of Clickhouse.
func (*JobProcess) GetKeys ¶ added in v0.2.0
func (s *JobProcess) GetKeys() []string
GetKeys returns the value of Keys.
func (*JobProcess) MarshalJSON ¶ added in v0.2.0
func (s *JobProcess) MarshalJSON() ([]byte, error)
MarshalJSON implements stdjson.Marshaler.
func (*JobProcess) SetClickhouse ¶ added in v0.2.0
func (s *JobProcess) SetClickhouse(val string)
SetClickhouse sets the value of Clickhouse.
func (*JobProcess) SetKeys ¶ added in v0.2.0
func (s *JobProcess) SetKeys(val []string)
SetKeys sets the value of Keys.
func (*JobProcess) UnmarshalJSON ¶ added in v0.2.0
func (s *JobProcess) UnmarshalJSON(data []byte) error
UnmarshalJSON implements stdjson.Unmarshaler.
func (*JobProcess) Validate ¶ added in v0.2.0
func (s *JobProcess) Validate() error
type Middleware ¶ added in v0.2.0
type Middleware = middleware.Middleware
Middleware is middleware type.
type OptInt64 ¶
OptInt64 is optional int64.
func NewOptInt64 ¶
NewOptInt64 returns new OptInt64 with value set to v.
func (OptInt64) MarshalJSON ¶ added in v0.2.0
MarshalJSON implements stdjson.Marshaler.
func (*OptInt64) UnmarshalJSON ¶ added in v0.2.0
UnmarshalJSON implements stdjson.Unmarshaler.
type OptString ¶
OptString is optional string.
func NewOptString ¶
NewOptString returns new OptString with value set to v.
func (OptString) MarshalJSON ¶ added in v0.2.0
MarshalJSON implements stdjson.Marshaler.
func (*OptString) UnmarshalJSON ¶ added in v0.2.0
UnmarshalJSON implements stdjson.Unmarshaler.
type Option ¶
type Option interface { ServerOption ClientOption }
Option is config option.
func WithMeterProvider ¶ added in v0.2.0
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 PollParams ¶
type PollParams struct { // Worker token. XToken string }
PollParams is parameters of poll operation.
type Progress ¶
type Progress struct { Event ProgressEvent `json:"event"` // Chunk key. Key string `json:"key"` InputSizeBytes OptInt64 `json:"input_size_bytes"` ContentSizeBytes OptInt64 `json:"content_size_bytes"` OutputSizeBytes OptInt64 `json:"output_size_bytes"` InputReadyBytes OptInt64 `json:"input_ready_bytes"` SHA256Input OptString `json:"sha256_input"` SHA256Content OptString `json:"sha256_content"` SHA256Output OptString `json:"sha256_output"` }
Ref: #/components/schemas/Progress
func (*Progress) GetContentSizeBytes ¶ added in v0.2.0
GetContentSizeBytes returns the value of ContentSizeBytes.
func (*Progress) GetEvent ¶ added in v0.2.0
func (s *Progress) GetEvent() ProgressEvent
GetEvent returns the value of Event.
func (*Progress) GetInputReadyBytes ¶ added in v0.2.0
GetInputReadyBytes returns the value of InputReadyBytes.
func (*Progress) GetInputSizeBytes ¶ added in v0.2.0
GetInputSizeBytes returns the value of InputSizeBytes.
func (*Progress) GetOutputSizeBytes ¶ added in v0.2.0
GetOutputSizeBytes returns the value of OutputSizeBytes.
func (*Progress) GetSHA256Content ¶ added in v0.2.0
GetSHA256Content returns the value of SHA256Content.
func (*Progress) GetSHA256Input ¶ added in v0.2.0
GetSHA256Input returns the value of SHA256Input.
func (*Progress) GetSHA256Output ¶ added in v0.2.0
GetSHA256Output returns the value of SHA256Output.
func (*Progress) MarshalJSON ¶ added in v0.2.0
MarshalJSON implements stdjson.Marshaler.
func (*Progress) SetContentSizeBytes ¶ added in v0.2.0
SetContentSizeBytes sets the value of ContentSizeBytes.
func (*Progress) SetEvent ¶ added in v0.2.0
func (s *Progress) SetEvent(val ProgressEvent)
SetEvent sets the value of Event.
func (*Progress) SetInputReadyBytes ¶ added in v0.2.0
SetInputReadyBytes sets the value of InputReadyBytes.
func (*Progress) SetInputSizeBytes ¶ added in v0.2.0
SetInputSizeBytes sets the value of InputSizeBytes.
func (*Progress) SetOutputSizeBytes ¶ added in v0.2.0
SetOutputSizeBytes sets the value of OutputSizeBytes.
func (*Progress) SetSHA256Content ¶ added in v0.2.0
SetSHA256Content sets the value of SHA256Content.
func (*Progress) SetSHA256Input ¶ added in v0.2.0
SetSHA256Input sets the value of SHA256Input.
func (*Progress) SetSHA256Output ¶ added in v0.2.0
SetSHA256Output sets the value of SHA256Output.
func (*Progress) UnmarshalJSON ¶ added in v0.2.0
UnmarshalJSON implements stdjson.Unmarshaler.
type ProgressEvent ¶
type ProgressEvent string
const ( ProgressEventReady ProgressEvent = "Ready" ProgressEventDownloading ProgressEvent = "Downloading" ProgressEventProcessed ProgressEvent = "Processed" )
func (*ProgressEvent) Decode ¶
func (s *ProgressEvent) Decode(d *jx.Decoder) error
Decode decodes ProgressEvent from json.
func (ProgressEvent) Encode ¶
func (s ProgressEvent) Encode(e *jx.Encoder)
Encode encodes ProgressEvent as json.
func (ProgressEvent) MarshalJSON ¶ added in v0.2.0
func (s ProgressEvent) MarshalJSON() ([]byte, error)
MarshalJSON implements stdjson.Marshaler.
func (ProgressEvent) MarshalText ¶ added in v0.2.0
func (s ProgressEvent) MarshalText() ([]byte, error)
MarshalText implements encoding.TextMarshaler.
func (*ProgressEvent) UnmarshalJSON ¶ added in v0.2.0
func (s *ProgressEvent) UnmarshalJSON(data []byte) error
UnmarshalJSON implements stdjson.Unmarshaler.
func (*ProgressEvent) UnmarshalText ¶ added in v0.2.0
func (s *ProgressEvent) UnmarshalText(data []byte) error
UnmarshalText implements encoding.TextUnmarshaler.
func (ProgressEvent) Validate ¶
func (s ProgressEvent) Validate() error
type ProgressParams ¶
type ProgressParams struct { // Worker token. XToken string }
ProgressParams is parameters of progress operation.
type Route ¶ added in v0.2.0
type Route struct {
// contains filtered or unexported fields
}
Route is route object.
func (Route) Name ¶ added in v0.2.0
Name returns ogen operation name.
It is guaranteed to be unique and not empty.
func (Route) OperationID ¶ added in v0.2.0
OperationID returns OpenAPI operationId.
func (Route) PathPattern ¶ added in v0.2.0
PathPattern returns OpenAPI path.
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 ¶ added in v0.2.0
type ServerOption interface {
// contains filtered or unexported methods
}
ServerOption is server config option.
func WithErrorHandler ¶ added in v0.2.0
func WithErrorHandler(h ErrorHandler) ServerOption
WithErrorHandler specifies error handler to use.
func WithMaxMultipartMemory ¶ added in v0.2.0
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 ¶ added in v0.2.0
func WithMethodNotAllowed(methodNotAllowed func(w http.ResponseWriter, r *http.Request, allowed string)) ServerOption
WithMethodNotAllowed specifies Method Not Allowed handler to use.
func WithMiddleware ¶ added in v0.2.0
func WithMiddleware(m ...Middleware) ServerOption
WithMiddleware specifies middlewares to use.
func WithNotFound ¶ added in v0.2.0
func WithNotFound(notFound http.HandlerFunc) ServerOption
WithNotFound specifies Not Found handler to use.
func WithPathPrefix ¶ added in v0.2.0
func WithPathPrefix(prefix string) ServerOption
WithPathPrefix specifies server path prefix.
type Status ¶
type Status struct {
Message string `json:"message"`
}
Ref: #/components/schemas/Status
func (*Status) GetMessage ¶ added in v0.2.0
GetMessage returns the value of Message.
func (*Status) MarshalJSON ¶ added in v0.2.0
MarshalJSON implements stdjson.Marshaler.
func (*Status) SetMessage ¶ added in v0.2.0
SetMessage sets the value of Message.
func (*Status) UnmarshalJSON ¶ added in v0.2.0
UnmarshalJSON implements stdjson.Unmarshaler.
type UnimplementedHandler ¶ added in v0.2.0
type UnimplementedHandler struct{}
UnimplementedHandler is no-op Handler which returns http.ErrNotImplemented.
func (UnimplementedHandler) NewError ¶ added in v0.2.0
func (UnimplementedHandler) NewError(ctx context.Context, err error) (r *ErrorStatusCode)
NewError creates *ErrorStatusCode from error returned by handler.
Used for common default response.
func (UnimplementedHandler) Poll ¶ added in v0.2.0
func (UnimplementedHandler) Poll(ctx context.Context, params PollParams) (r Job, _ error)
Poll implements poll operation.
Request job from coordinator.
POST /job/poll
func (UnimplementedHandler) Progress ¶ added in v0.2.0
func (UnimplementedHandler) Progress(ctx context.Context, req *Progress, params ProgressParams) (r *Status, _ error)
Progress implements progress operation.
Report progress.
POST /progress
Source Files ¶
- oas.go
- 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