server

package
v0.0.0-...-8b3e257 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 19, 2024 License: MIT Imports: 7 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddResumePath

func AddResumePath() string

AddResumePath returns the URL path to the resume service add HTTP endpoint.

func DecodeAddRequest

func DecodeAddRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (any, error)

DecodeAddRequest returns a decoder for requests sent to the resume add endpoint.

func EncodeAddResponse

func EncodeAddResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error

EncodeAddResponse returns an encoder for responses returned by the resume add endpoint.

func EncodeListResponse

func EncodeListResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error

EncodeListResponse returns an encoder for responses returned by the resume list endpoint.

func ListResumePath

func ListResumePath() string

ListResumePath returns the URL path to the resume service list HTTP endpoint.

func Mount

func Mount(mux goahttp.Muxer, h *Server)

Mount configures the mux to serve the resume endpoints.

func MountAddHandler

func MountAddHandler(mux goahttp.Muxer, h http.Handler)

MountAddHandler configures the mux to serve the "resume" service "add" endpoint.

func MountListHandler

func MountListHandler(mux goahttp.Muxer, h http.Handler)

MountListHandler configures the mux to serve the "resume" service "list" endpoint.

func NewAddHandler

func NewAddHandler(
	endpoint goa.Endpoint,
	mux goahttp.Muxer,
	decoder func(*http.Request) goahttp.Decoder,
	encoder func(context.Context, http.ResponseWriter) goahttp.Encoder,
	errhandler func(context.Context, http.ResponseWriter, error),
	formatter func(ctx context.Context, err error) goahttp.Statuser,
) http.Handler

NewAddHandler creates a HTTP handler which loads the HTTP request and calls the "resume" service "add" endpoint.

func NewAddResume

func NewAddResume(body []*ResumeRequestBody) []*resume.Resume

NewAddResume builds a resume service add endpoint payload.

func NewListHandler

func NewListHandler(
	endpoint goa.Endpoint,
	mux goahttp.Muxer,
	decoder func(*http.Request) goahttp.Decoder,
	encoder func(context.Context, http.ResponseWriter) goahttp.Encoder,
	errhandler func(context.Context, http.ResponseWriter, error),
	formatter func(ctx context.Context, err error) goahttp.Statuser,
) http.Handler

NewListHandler creates a HTTP handler which loads the HTTP request and calls the "resume" service "list" endpoint.

func NewResumeAddDecoder

func NewResumeAddDecoder(mux goahttp.Muxer, resumeAddDecoderFn ResumeAddDecoderFunc) func(r *http.Request) goahttp.Decoder

NewResumeAddDecoder returns a decoder to decode the multipart request for the "resume" service "add" endpoint.

func ValidateEducationRequestBody

func ValidateEducationRequestBody(body *EducationRequestBody) (err error)

ValidateEducationRequestBody runs the validations defined on EducationRequestBody

func ValidateExperienceRequestBody

func ValidateExperienceRequestBody(body *ExperienceRequestBody) (err error)

ValidateExperienceRequestBody runs the validations defined on ExperienceRequestBody

func ValidateResumeRequestBody

func ValidateResumeRequestBody(body *ResumeRequestBody) (err error)

ValidateResumeRequestBody runs the validations defined on ResumeRequestBody

Types

type EducationRequestBody

type EducationRequestBody struct {
	// Name of the institution
	Institution *string `form:"institution,omitempty" json:"institution,omitempty" xml:"institution,omitempty"`
	// Major name
	Major *string `form:"major,omitempty" json:"major,omitempty" xml:"major,omitempty"`
}

EducationRequestBody is used to define fields on request body types.

type EducationResponse

type EducationResponse struct {
	// Name of the institution
	Institution string `form:"institution" json:"institution" xml:"institution"`
	// Major name
	Major string `form:"major" json:"major" xml:"major"`
}

EducationResponse is used to define fields on response body types.

type ExperienceRequestBody

type ExperienceRequestBody struct {
	// Name of the company
	Company *string `form:"company,omitempty" json:"company,omitempty" xml:"company,omitempty"`
	// Name of the role in the company
	Role *string `form:"role,omitempty" json:"role,omitempty" xml:"role,omitempty"`
	// Duration (in years) in the company
	Duration *int `form:"duration,omitempty" json:"duration,omitempty" xml:"duration,omitempty"`
}

ExperienceRequestBody is used to define fields on request body types.

type ExperienceResponse

type ExperienceResponse struct {
	// Name of the company
	Company string `form:"company" json:"company" xml:"company"`
	// Name of the role in the company
	Role string `form:"role" json:"role" xml:"role"`
	// Duration (in years) in the company
	Duration int `form:"duration" json:"duration" xml:"duration"`
}

ExperienceResponse is used to define fields on response body types.

type MountPoint

type MountPoint struct {
	// Method is the name of the service method served by the mounted HTTP handler.
	Method string
	// Verb is the HTTP method used to match requests to the mounted handler.
	Verb string
	// Pattern is the HTTP request path pattern used to match requests to the
	// mounted handler.
	Pattern string
}

MountPoint holds information about the mounted endpoints.

type ResumeAddDecoderFunc

type ResumeAddDecoderFunc func(*multipart.Reader, *[]*resume.Resume) error

ResumeAddDecoderFunc is the type to decode multipart request for the "resume" service "add" endpoint.

type ResumeRequestBody

type ResumeRequestBody struct {
	// Name in the resume
	Name *string `form:"name,omitempty" json:"name,omitempty" xml:"name,omitempty"`
	// Experience section in the resume
	Experience []*ExperienceRequestBody `form:"experience,omitempty" json:"experience,omitempty" xml:"experience,omitempty"`
	// Education section in the resume
	Education []*EducationRequestBody `form:"education,omitempty" json:"education,omitempty" xml:"education,omitempty"`
}

ResumeRequestBody is used to define fields on request body types.

type Server

type Server struct {
	Mounts []*MountPoint
	List   http.Handler
	Add    http.Handler
}

Server lists the resume service endpoint HTTP handlers.

func New

func New(
	e *resume.Endpoints,
	mux goahttp.Muxer,
	decoder func(*http.Request) goahttp.Decoder,
	encoder func(context.Context, http.ResponseWriter) goahttp.Encoder,
	errhandler func(context.Context, http.ResponseWriter, error),
	formatter func(ctx context.Context, err error) goahttp.Statuser,
	resumeAddDecoderFn ResumeAddDecoderFunc,
) *Server

New instantiates HTTP handlers for all the resume service endpoints using the provided encoder and decoder. The handlers are mounted on the given mux using the HTTP verb and path defined in the design. errhandler is called whenever a response fails to be encoded. formatter is used to format errors returned by the service methods prior to encoding. Both errhandler and formatter are optional and can be nil.

func (*Server) MethodNames

func (s *Server) MethodNames() []string

MethodNames returns the methods served.

func (*Server) Mount

func (s *Server) Mount(mux goahttp.Muxer)

Mount configures the mux to serve the resume endpoints.

func (*Server) Service

func (s *Server) Service() string

Service returns the name of the service served.

func (*Server) Use

func (s *Server) Use(m func(http.Handler) http.Handler)

Use wraps the server handlers with the given middleware.

type StoredResumeResponse

type StoredResumeResponse struct {
	// ID of the resume
	ID int `form:"id" json:"id" xml:"id"`
	// Name in the resume
	Name string `form:"name" json:"name" xml:"name"`
	// Experience section in the resume
	Experience []*ExperienceResponse `form:"experience" json:"experience" xml:"experience"`
	// Education section in the resume
	Education []*EducationResponse `form:"education" json:"education" xml:"education"`
	// Time when resume was created
	CreatedAt string `form:"created_at" json:"created_at" xml:"created_at"`
}

StoredResumeResponse is used to define fields on response body types.

type StoredResumeResponseCollection

type StoredResumeResponseCollection []*StoredResumeResponse

StoredResumeResponseCollection is the type of the "resume" service "list" endpoint HTTP response body.

func NewStoredResumeResponseCollection

func NewStoredResumeResponseCollection(res resumeviews.StoredResumeCollectionView) StoredResumeResponseCollection

NewStoredResumeResponseCollection builds the HTTP response body from the result of the "list" endpoint of the "resume" service.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL