service

package
v0.0.51 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2021 License: MIT Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseBody

func ParseBody(data []byte, destination interface{}) error

Types

type Collection

type Collection []Config

type Config

type Config struct {
	IsPrivate bool
	Path      string
	Method    string
	Build     func(meta.RequestId, RawHeaders, RawBody, RawParams) (TPL, error)
}

type ContentResponse

type ContentResponse struct {
	Content    []interface{} `json:"content"`
	First      bool          `json:"first"`
	Last       bool          `json:"last"`
	TotalPages int           `json:"total_pages"`
	ContentResponseMeta
}

func ToContentResponse

func ToContentResponse(
	resources []interface{},
	meta ContentResponseMeta,
) ContentResponse

type ContentResponseMeta

type ContentResponseMeta struct {
	Size  int `json:"size"`
	Total int `json:"total"`
	Page  int `json:"current_page"`
}

type PrivateTPL added in v0.0.26

type PrivateTPL interface {
	Auth(meta.RequestId, RawHeaders, RawBody, RawParams) bool
	TPL
}

type RawBody

type RawBody []byte

type RawHeader added in v0.0.26

type RawHeader struct {
	Key    string
	Values []string
}

func (RawHeader) Value added in v0.0.26

func (ps RawHeader) Value() string

type RawHeaders added in v0.0.26

type RawHeaders []RawHeader

func (RawHeaders) Get added in v0.0.26

func (ps RawHeaders) Get(name string) (*RawHeader, bool)

type RawParam

type RawParam struct {
	Key    string
	Value  string
	Values []string
}

type RawParams

type RawParams []RawParam

func (RawParams) Get

func (ps RawParams) Get(name string) (*RawParam, bool)

type ResultError

type ResultError struct {
	Status     int                      `json:"-"`
	Field      string                   `json:"-"`
	ErrMessage string                   `json:"-"`
	Message    string                   `json:"message"`
	Reasons    []map[string]interface{} `json:"reasons"`
}

func ToResultError

func ToResultError(err error, message string, status int) *ResultError

func (*ResultError) Error

func (m *ResultError) Error() string

func (*ResultError) GetDetails

func (m *ResultError) GetDetails() ResultError

func (*ResultError) GetMessage

func (m *ResultError) GetMessage() string

func (*ResultError) GetStatus

func (m *ResultError) GetStatus() int

type TPL

type TPL interface {
	Result() (interface{}, error)
}

Jump to

Keyboard shortcuts

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