controllers

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandleDelete

func HandleDelete(handler IHandler) func(http.ResponseWriter, *http.Request) (any, error)

HandleDelete is a higher-order function that takes an IHandler as input and returns a function that handles a DELETE request.

func HandleGet

func HandleGet(handler IHandler) func(http.ResponseWriter, *http.Request) (any, error)

HandleGet is a higher-order function that takes an IHandler as input and returns a function that handles a GET request.

func HandleGetById

func HandleGetById(handler IHandler) func(http.ResponseWriter, *http.Request) (any, error)

HandleGetById is a higher-order function that takes an IHandler as input and returns a function that handles a GET request by ID.

func HandlePost

func HandlePost(handler IHandler) func(http.ResponseWriter, *http.Request) (any, error)

HandlePost is a higher-order function that takes an IHandler as input and returns a function that handles a POST request.

func HandlePut

func HandlePut(handler IHandler) func(http.ResponseWriter, *http.Request) (any, error)

HandlePut is a higher-order function that takes an IHandler as input and returns a function that handles a PUT request.

func ParseFormAndQuery

func ParseFormAndQuery(request *http.Request) (map[string]interface{}, error)

func ParseJSONBody

func ParseJSONBody(request *http.Request) (map[string]interface{}, error)

func ParseMultipartFormFile

func ParseMultipartFormFile(request *http.Request, formKey string) ([]byte, error)

func ParseRequestData

func ParseRequestData(request *http.Request) (map[string]interface{}, error)

Types

type IHandler

type IHandler interface {
	GetAll() (any, error)
	GetById(id string) (any, error)
	Post(data map[string]any) (bool, string, error)
	Put(id string, data map[string]any) (bool, error)
	Delete(id string) (bool, error)
}

IHandler is an interface for handling CRUD operations on a resource. It defines methods for retrieving, creating, updating, and deleting data.

Directories

Path Synopsis
database

Jump to

Keyboard shortcuts

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