tz

package module
v1.0.218 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2023 License: MIT Imports: 8 Imported by: 0

README

Tanzanite

Golang tools for rapid web development under the standard library

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bind

func Bind(r *http.Request, v interface{}) error

Bind is for binding client data into the struct, map or interface{}

func Binder

func Binder(r *http.Request, v interface{})

Binder does the same as Bind() but handles panic the error, hence useful if you don't want to check error and modify it but just panic it

func GetIP

func GetIP(r *http.Request) (ip string, err error)

GetIP is for getting the IP address from the client request

func MIME

func MIME(w http.ResponseWriter, mimeType string)

MIME sets the content mime type

func Redirect

func Redirect(w http.ResponseWriter, r *http.Request, statusCodeAndPath ...interface{})

Redirect for redirecting the client request

func Send

func Send(w http.ResponseWriter, statusCodeAndData ...interface{})

Send sends any data. Struct and map are sent as json whereas, other data are treated as plain texts. For sending other data as json, you might require SendJSON()

func SendJSON

func SendJSON(w http.ResponseWriter, statusCodeAndData ...interface{})

SendJSON for sending error in json format and providing the error code

func SendString

func SendString(w http.ResponseWriter, statusCodeAndData ...interface{})

SendString is for sending data in string format to the client

Types

type Map

type Map map[string]interface{}

Map is for simplifying sending of json data

func Msg

func Msg(msg string) (simpleMsgResponse Map)

Msg models the msg to a simple msg:string data

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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