{"modulePath":"github.com/vcabbage/kit","version":"v0.5.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package profilesvc\n\n## Variables\n\n```go\nvar (\n\tErrInconsistentIDs = errors.New(\"inconsistent IDs\")\n\tErrAlreadyExists   = errors.New(\"already exists\")\n\tErrNotFound        = errors.New(\"not found\")\n)\n```\n\n```go\nvar (\n\t// ErrBadRouting is returned when an expected path variable is missing.\n\t// It always indicates programmer error.\n\tErrBadRouting = errors.New(\"inconsistent mapping between route and handler (programmer error)\")\n)\n```\n\n## Functions\n\n```go\nfunc MakeDeleteAddressEndpoint(s Service) endpoint.Endpoint\n```\nMakeDeleteAddressEndpoint returns an endpoint via the passed service. Primarily useful in a server.\n\n```go\nfunc MakeDeleteProfileEndpoint(s Service) endpoint.Endpoint\n```\nMakeDeleteProfileEndpoint returns an endpoint via the passed service. Primarily useful in a server.\n\n```go\nfunc MakeGetAddressEndpoint(s Service) endpoint.Endpoint\n```\nMakeGetAddressEndpoint returns an endpoint via the passed service. Primarily useful in a server.\n\n```go\nfunc MakeGetAddressesEndpoint(s Service) endpoint.Endpoint\n```\nMakeGetAddressesEndpoint returns an endpoint via the passed service. Primarily useful in a server.\n\n```go\nfunc MakeGetProfileEndpoint(s Service) endpoint.Endpoint\n```\nMakeGetProfileEndpoint returns an endpoint via the passed service. Primarily useful in a server.\n\n```go\nfunc MakeHTTPHandler(s Service, logger log.Logger) http.Handler\n```\nMakeHTTPHandler mounts all of the service endpoints into an http.Handler. Useful in a profilesvc server.\n\n```go\nfunc MakePatchProfileEndpoint(s Service) endpoint.Endpoint\n```\nMakePatchProfileEndpoint returns an endpoint via the passed service. Primarily useful in a server.\n\n```go\nfunc MakePostAddressEndpoint(s Service) endpoint.Endpoint\n```\nMakePostAddressEndpoint returns an endpoint via the passed service. Primarily useful in a server.\n\n```go\nfunc MakePostProfileEndpoint(s Service) endpoint.Endpoint\n```\nMakePostProfileEndpoint returns an endpoint via the passed service. Primarily useful in a server.\n\n```go\nfunc MakePutProfileEndpoint(s Service) endpoint.Endpoint\n```\nMakePutProfileEndpoint returns an endpoint via the passed service. Primarily useful in a server.\n\n## Types\n\n```go\ntype Address struct {\n\tID       string `json:\"id\"`\n\tLocation string `json:\"location,omitempty\"`\n}\n```\nAddress is a field of a user profile. ID should be unique within the profile (at a minimum).\n\n```go\ntype Endpoints struct {\n\tPostProfileEndpoint   endpoint.Endpoint\n\tGetProfileEndpoint    endpoint.Endpoint\n\tPutProfileEndpoint    endpoint.Endpoint\n\tPatchProfileEndpoint  endpoint.Endpoint\n\tDeleteProfileEndpoint endpoint.Endpoint\n\tGetAddressesEndpoint  endpoint.Endpoint\n\tGetAddressEndpoint    endpoint.Endpoint\n\tPostAddressEndpoint   endpoint.Endpoint\n\tDeleteAddressEndpoint endpoint.Endpoint\n}\n```\nEndpoints collects all of the endpoints that compose a profile service. It's meant to be used as a helper struct, to collect all of the endpoints into a single parameter.\n\nIn a server, it's useful for functions that need to operate on a per-endpoint basis. For example, you might pass an Endpoints to a function that produces an http.Handler, with each method (endpoint) wired up to a specific path. (It is probably a mistake in design to invoke the Service methods on the Endpoints struct in a server.)\n\nIn a client, it's useful to collect individually constructed endpoints into a single type that implements the Service interface. For example, you might construct individual endpoints using transport/http.NewClient, combine them into an Endpoints, and return it to the caller as a Service.\n\n```go\nfunc MakeClientEndpoints(instance string) (Endpoints, error)\n```\nMakeClientEndpoints returns an Endpoints struct where each endpoint invokes the corresponding method on the remote instance, via a transport/http.Client. Useful in a profilesvc client.\n\n```go\nfunc MakeServerEndpoints(s Service) Endpoints\n```\nMakeServerEndpoints returns an Endpoints struct where each endpoint invokes the corresponding method on the provided service. Useful in a profilesvc server.\n\n```go\nfunc (e Endpoints) DeleteAddress(ctx context.Context, profileID string, addressID string) error\n```\nDeleteAddress implements Service. Primarily useful in a client.\n\n```go\nfunc (e Endpoints) DeleteProfile(ctx context.Context, id string) error\n```\nDeleteProfile implements Service. Primarily useful in a client.\n\n```go\nfunc (e Endpoints) GetAddress(ctx context.Context, profileID string, addressID string) (Address, error)\n```\nGetAddress implements Service. Primarily useful in a client.\n\n```go\nfunc (e Endpoints) GetAddresses(ctx context.Context, profileID string) ([]Address, error)\n```\nGetAddresses implements Service. Primarily useful in a client.\n\n```go\nfunc (e Endpoints) GetProfile(ctx context.Context, id string) (Profile, error)\n```\nGetProfile implements Service. Primarily useful in a client.\n\n```go\nfunc (e Endpoints) PatchProfile(ctx context.Context, id string, p Profile) error\n```\nPatchProfile implements Service. Primarily useful in a client.\n\n```go\nfunc (e Endpoints) PostAddress(ctx context.Context, profileID string, a Address) error\n```\nPostAddress implements Service. Primarily useful in a client.\n\n```go\nfunc (e Endpoints) PostProfile(ctx context.Context, p Profile) error\n```\nPostProfile implements Service. Primarily useful in a client.\n\n```go\nfunc (e Endpoints) PutProfile(ctx context.Context, id string, p Profile) error\n```\nPutProfile implements Service. Primarily useful in a client.\n\n```go\ntype Middleware func(Service) Service\n```\nMiddleware describes a service (as opposed to endpoint) middleware.\n\n```go\nfunc LoggingMiddleware(logger log.Logger) Middleware\n```\n\n```go\ntype Profile struct {\n\tID        string    `json:\"id\"`\n\tName      string    `json:\"name,omitempty\"`\n\tAddresses []Address `json:\"addresses,omitempty\"`\n}\n```\nProfile represents a single user profile. ID should be globally unique.\n\n```go\ntype Service interface {\n\tPostProfile(ctx context.Context, p Profile) error\n\tGetProfile(ctx context.Context, id string) (Profile, error)\n\tPutProfile(ctx context.Context, id string, p Profile) error\n\tPatchProfile(ctx context.Context, id string, p Profile) error\n\tDeleteProfile(ctx context.Context, id string) error\n\tGetAddresses(ctx context.Context, profileID string) ([]Address, error)\n\tGetAddress(ctx context.Context, profileID string, addressID string) (Address, error)\n\tPostAddress(ctx context.Context, profileID string, a Address) error\n\tDeleteAddress(ctx context.Context, profileID string, addressID string) error\n}\n```\nService is a simple CRUD interface for user profiles.\n\n```go\nfunc NewInmemService() Service\n```\n\n","path":"github.com/vcabbage/kit/examples/profilesvc","name":"profilesvc","synopsis":"","isRedistributable":true}
