rating

package
v0.0.0-...-520f1c6 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const ServiceName = "rating"

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 = [2]string{"Get", "Update"}

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 MakeInternalError

func MakeInternalError(err error) *goa.ServiceError

MakeInternalError builds a goa.ServiceError from an error.

func MakeInvalidScopes

func MakeInvalidScopes(err error) *goa.ServiceError

MakeInvalidScopes builds a goa.ServiceError from an error.

func MakeInvalidToken

func MakeInvalidToken(err error) *goa.ServiceError

MakeInvalidToken builds a goa.ServiceError from an error.

func MakeNotFound

func MakeNotFound(err error) *goa.ServiceError

MakeNotFound builds a goa.ServiceError from an error.

func NewGetEndpoint

func NewGetEndpoint(s Service, authJWTFn security.AuthJWTFunc) goa.Endpoint

NewGetEndpoint returns an endpoint function that calls the method "Get" of service "rating".

func NewUpdateEndpoint

func NewUpdateEndpoint(s Service, authJWTFn security.AuthJWTFunc) goa.Endpoint

NewUpdateEndpoint returns an endpoint function that calls the method "Update" of service "rating".

Types

type Auther

type Auther interface {
	// JWTAuth implements the authorization logic for the JWT security scheme.
	JWTAuth(ctx context.Context, token string, schema *security.JWTScheme) (context.Context, error)
}

Auther defines the authorization functions to be implemented by the service.

type Client

type Client struct {
	GetEndpoint    goa.Endpoint
	UpdateEndpoint goa.Endpoint
}

Client is the "rating" service client.

func NewClient

func NewClient(get, update goa.Endpoint) *Client

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

func (*Client) Get

func (c *Client) Get(ctx context.Context, p *GetPayload) (res *GetResult, err error)

Get calls the "Get" endpoint of the "rating" service.

func (*Client) Update

func (c *Client) Update(ctx context.Context, p *UpdatePayload) (err error)

Update calls the "Update" endpoint of the "rating" service.

type Endpoints

type Endpoints struct {
	Get    goa.Endpoint
	Update goa.Endpoint
}

Endpoints wraps the "rating" service endpoints.

func NewEndpoints

func NewEndpoints(s Service) *Endpoints

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

func (*Endpoints) Use

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

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

type GetPayload

type GetPayload struct {
	// ID of a resource
	ID uint
	// JWT
	Token string
}

GetPayload is the payload type of the rating service Get method.

type GetResult

type GetResult struct {
	// User rating for resource
	Rating int
}

GetResult is the result type of the rating service Get method.

type Service

type Service interface {
	// Find user's rating for a resource
	Get(context.Context, *GetPayload) (res *GetResult, err error)
	// Update user's rating for a resource
	Update(context.Context, *UpdatePayload) (err error)
}

The rating service exposes endpoints to read and write user's rating for resources

type UpdatePayload

type UpdatePayload struct {
	// ID of a resource
	ID uint
	// User rating for resource
	Rating uint
	// JWT
	Token string
}

UpdatePayload is the payload type of the rating service Update method.

Jump to

Keyboard shortcuts

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