front

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const ServiceName = "front"

ServiceName is the name of the service as defined in the design. This is the same value that is set in the endpoint request contexts under the ServiceKey key.

Variables

View Source
var MethodNames = [1]string{"forecast"}

MethodNames lists the service method names as defined in the design. These are the same values that are set in the endpoint request contexts under the MethodKey key.

Functions

func MakeNotUsa

func MakeNotUsa(err error) *goa.ServiceError

MakeNotUsa builds a goa.ServiceError from an error.

func NewForecastEndpoint

func NewForecastEndpoint(s Service) goa.Endpoint

NewForecastEndpoint returns an endpoint function that calls the method "forecast" of service "front".

Types

type Client

type Client struct {
	ForecastEndpoint goa.Endpoint
}

Client is the "front" service client.

func NewClient

func NewClient(forecast goa.Endpoint) *Client

NewClient initializes a "front" service client given the endpoints.

func (*Client) Forecast

func (c *Client) Forecast(ctx context.Context, p string) (res *Forecast2, err error)

Forecast calls the "forecast" endpoint of the "front" service. Forecast may return the following errors:

  • "not_usa" (type *goa.ServiceError): IP address is not in the US
  • error: internal error

type Endpoints

type Endpoints struct {
	Forecast goa.Endpoint
}

Endpoints wraps the "front" service endpoints.

func NewEndpoints

func NewEndpoints(s Service) *Endpoints

NewEndpoints wraps the methods of the "front" service with endpoints.

func (*Endpoints) Use

func (e *Endpoints) Use(m func(goa.Endpoint) goa.Endpoint)

Use applies the given middleware to all the "front" service endpoints.

type Forecast2

type Forecast2 struct {
	// Forecast location
	Location *Location
	// Weather forecast periods
	Periods []*Period
}

Forecast2 is the result type of the front service forecast method.

type Location

type Location struct {
	// Latitude
	Lat float64
	// Longitude
	Long float64
	// City
	City string
	// State
	State string
}

Geographical location

type Period

type Period struct {
	// Period name
	Name string
	// Start time
	StartTime string
	// End time
	EndTime string
	// Temperature
	Temperature int
	// Temperature unit
	TemperatureUnit string
	// Summary
	Summary string
}

Weather forecast period

type Service

type Service interface {
	// Retrieve weather forecast for given IP
	Forecast(context.Context, string) (res *Forecast2, err error)
}

Public HTTP frontend

Jump to

Keyboard shortcuts

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