http_handler

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractHost

func ExtractHost(hostport string) string

ExtractHost splits a host / port pair (or just a host) and returns the host. This is large borrowed from `net/url.splitHostPort`.

func FindMany

func FindMany(storage storageTY.Plugin, w http.ResponseWriter, r *http.Request, entityName string, entities interface{})

FindMany func

func FindOne

func FindOne(storage storageTY.Plugin, w http.ResponseWriter, r *http.Request, entityName string, entity interface{})

FindOne func

func GetParameter

func GetParameter(key string, parameters map[string][]string) string

GetParameter returns a first value or empty

func GetParameters

func GetParameters(key string, parameters map[string][]string) []string

GetParameters returns all values or empty slice

func LoadData

func LoadData(w http.ResponseWriter, r *http.Request, entityFn func(f []storageTY.Filter, p *storageTY.Pagination) (interface{}, error))

LoadData loads data

func LoadEntity

func LoadEntity(w http.ResponseWriter, r *http.Request, entity interface{}) error

LoadEntity func

func Params

func Params(request *http.Request) ([]storageTY.Filter, *storageTY.Pagination, error)

Params func

func PostErrorResponse

func PostErrorResponse(w http.ResponseWriter, message string, code int)

func PostSuccessResponse

func PostSuccessResponse(w http.ResponseWriter, data interface{})

func ReceivedQueryMap

func ReceivedQueryMap(request *http.Request) (map[string][]string, error)

ReceivedQueryMap returns all the user query and url input

func SaveEntity

func SaveEntity(storage storageTY.Plugin, w http.ResponseWriter, r *http.Request, entityName string, entity interface{}, bwFunc func(entity interface{}, filters *[]storageTY.Filter) error)

SaveEntity func

func UpdateData

func UpdateData(w http.ResponseWriter, r *http.Request, entity interface{}, updateFn func(f []storageTY.Filter, p *storageTY.Pagination, d []byte) (interface{}, error))

UpdateData loads data

func WriteResponse

func WriteResponse(w http.ResponseWriter, data []byte)

Types

This section is empty.

Jump to

Keyboard shortcuts

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