rest

package
v0.3.9 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2024 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MissingInterceptions        = "missing interceptions: %v"
	MissingEndpointInterception = "missing endpoint interception: %v"
	MissingChildrenMap          = "missing children map: %v"
	FailedToTraverse            = "failed to traverse: %v"
)
View Source
var (
	Email        = NewParam("email")
	Username     = NewParam("username")
	Token        = NewParam("token")
	Id           = NewParam("id")
	PermissionId = NewParam("permission-id")
	RoleId       = NewParam("role-id")
	UserId       = NewParam("user-id")
	JwtId        = NewParam("jwt-id")
)

Param values

Functions

This section is empty.

Types

type Endpoint

type Endpoint struct {
	Name   string
	Params []Param
}

Endpoint is the REST endpoint

func NewEndpoint

func NewEndpoint(name string, params ...Param) *Endpoint

NewEndpoint creates a new Endpoint

func (Endpoint) String

func (r Endpoint) String() string

String returns the string representation of the Endpoint

type Map added in v0.3.6

type Map struct {
	Interceptions *map[string]map[Method]grpc.Method
	ChildrenMaps  *map[string]*Map
}

Map struct for the REST endpoints

func NewMap added in v0.3.6

func NewMap(interceptions *map[string]map[Method]grpc.Method, childrenMaps *map[string]*Map) *Map

NewMap creates a new REST map

func (*Map) Traverse added in v0.3.6

func (m *Map) Traverse(debug bool, relativeURI string, restMethod Method) (*grpc.Method, error)

Traverse traverses the REST map

type Mapper added in v0.3.6

type Mapper interface {
	Traverse(relativeURI string, restMethod Method) (*grpc.Method, error)
}

Mapper is the interface for the REST map

type Method

type Method int

Method is the type of REST request method

const (
	GET Method = iota
	POST
	PUT
	PATCH
	DELETE
	INVALID
)

Method values

func GetMethod

func GetMethod(method string) Method

GetMethod returns the Method from the string

type Param

type Param struct {
	Name string
}

Param is the type of REST request parameter

func NewParam

func NewParam(name string) Param

NewParam creates a new Param

func (Param) String

func (r Param) String() string

String returns the string representation of the Param

Jump to

Keyboard shortcuts

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