moonshine

package module
v0.0.0-...-5e30476 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2023 License: MIT Imports: 15 Imported by: 0

README

moonshine

[WIP] moonshine is HTTP web framework written in Go (Golang)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context struct {
	Request *http.Request

	Params Params

	Keys map[string]any

	MaxMultipartMemory int64
	// contains filtered or unexported fields
}

func NewCtx

func NewCtx(req *http.Request, res http.ResponseWriter) *Context

func (*Context) Abort

func (c *Context) Abort()

func (*Context) AbortWithError

func (c *Context) AbortWithError(code int, err error) error

func (*Context) AbortWithStatus

func (c *Context) AbortWithStatus(code int)

func (*Context) AbortWithStatusJSON

func (c *Context) AbortWithStatusJSON(code int, jsonObj any)

func (*Context) AddParam

func (c *Context) AddParam(key, value string)

func (*Context) Bind

func (c *Context) Bind(obj any) error

func (*Context) BindHeader

func (c *Context) BindHeader(obj any) error

BindHeader is a shortcut for c.MustBindWith(obj, binding.Header).

func (*Context) BindJSON

func (c *Context) BindJSON(obj any) error

BindJSON is a shortcut for c.MustBindWith(obj, binding.JSON).

func (*Context) BindQuery

func (c *Context) BindQuery(obj any) error

BindQuery is a shortcut for c.MustBindWith(obj, binding.Query).

func (*Context) BindTOML

func (c *Context) BindTOML(obj any) error

BindTOML is a shortcut for c.MustBindWith(obj, binding.TOML).

func (*Context) BindUri

func (c *Context) BindUri(obj any) error

func (*Context) BindXML

func (c *Context) BindXML(obj any) error

BindXML is a shortcut for c.MustBindWith(obj, binding.BindXML).

func (*Context) BindYAML

func (c *Context) BindYAML(obj any) error

BindYAML is a shortcut for c.MustBindWith(obj, binding.YAML).

func (*Context) ContentType

func (c *Context) ContentType() string

func (*Context) Context

func (c *Context) Context() context.Context

func (*Context) Cookie

func (c *Context) Cookie(name string) (string, error)

func (*Context) Copy

func (c *Context) Copy() *Context

func (*Context) DefaultPostForm

func (c *Context) DefaultPostForm(key, defaultValue string) string

func (*Context) DefaultQuery

func (c *Context) DefaultQuery(key, defaultValue string) string

func (*Context) Error

func (c *Context) Error(err error) error

func (*Context) FormFile

func (c *Context) FormFile(name string) (*multipart.FileHeader, error)

func (*Context) Get

func (c *Context) Get(key string) (value any, exists bool)

func (*Context) GetBool

func (c *Context) GetBool(key string) (b bool)

func (*Context) GetDuration

func (c *Context) GetDuration(key string) (d time.Duration)

func (*Context) GetFloat64

func (c *Context) GetFloat64(key string) (f64 float64)

func (*Context) GetInt

func (c *Context) GetInt(key string) (i int)

func (*Context) GetInt64

func (c *Context) GetInt64(key string) (i64 int64)

func (*Context) GetPostForm

func (c *Context) GetPostForm(key string) (string, bool)

func (*Context) GetPostFormArray

func (c *Context) GetPostFormArray(key string) (values []string, ok bool)

func (*Context) GetPostFormMap

func (c *Context) GetPostFormMap(key string) (map[string]string, bool)

func (*Context) GetQuery

func (c *Context) GetQuery(key string) (string, bool)

func (*Context) GetQueryArray

func (c *Context) GetQueryArray(key string) (values []string, ok bool)

func (*Context) GetQueryMap

func (c *Context) GetQueryMap(key string) (map[string]string, bool)

func (*Context) GetString

func (c *Context) GetString(key string) (s string)

func (*Context) GetStringMap

func (c *Context) GetStringMap(key string) (sm map[string]any)

func (*Context) GetStringMapString

func (c *Context) GetStringMapString(key string) (sms map[string]string)

func (*Context) GetStringMapStringSlice

func (c *Context) GetStringMapStringSlice(key string) (smss map[string][]string)

func (*Context) GetStringSlice

func (c *Context) GetStringSlice(key string) (ss []string)

func (*Context) GetTime

func (c *Context) GetTime(key string) (t time.Time)

func (*Context) GetUint

func (c *Context) GetUint(key string) (ui uint)

func (*Context) GetUint64

func (c *Context) GetUint64(key string) (ui64 uint64)

func (*Context) Header

func (c *Context) Header(key, value string)

func (*Context) IsWebsocket

func (c *Context) IsWebsocket() bool

func (*Context) JSON

func (c *Context) JSON(code int, obj any)

func (*Context) MultipartForm

func (c *Context) MultipartForm() (*multipart.Form, error)

func (*Context) MustBindWith

func (c *Context) MustBindWith(obj any, b binding.Binding) error

func (*Context) MustGet

func (c *Context) MustGet(key string) any

func (*Context) Param

func (c *Context) Param(key string) string

Param returns the value of the URL param.

func (*Context) PostForm

func (c *Context) PostForm(key string) (value string)

func (*Context) PostFormArray

func (c *Context) PostFormArray(key string) (values []string)

func (*Context) PostFormMap

func (c *Context) PostFormMap(key string) (dicts map[string]string)

func (*Context) Query

func (c *Context) Query(key string) (value string)

func (*Context) QueryMap

func (c *Context) QueryMap(key string) (dicts map[string]string)

func (*Context) Render

func (c *Context) Render(code int, r render.Render)

func (*Context) SaveUploadedFile

func (c *Context) SaveUploadedFile(file *multipart.FileHeader, dst string) error

func (*Context) Set

func (c *Context) Set(key string, value any)

func (*Context) SetCookie

func (c *Context) SetCookie(name, value string, maxAge int, path, domain string, secure, httpOnly bool)

func (*Context) SetSameSite

func (c *Context) SetSameSite(samesite http.SameSite)

func (*Context) ShouldBind

func (c *Context) ShouldBind(obj any) error

func (*Context) ShouldBindHeader

func (c *Context) ShouldBindHeader(obj any) error

ShouldBindHeader is a shortcut for c.ShouldBindWith(obj, binding.Header).

func (*Context) ShouldBindJSON

func (c *Context) ShouldBindJSON(obj any) error

ShouldBindJSON is a shortcut for c.ShouldBindWith(obj, binding.JSON).

func (*Context) ShouldBindQuery

func (c *Context) ShouldBindQuery(obj any) error

ShouldBindQuery is a shortcut for c.ShouldBindWith(obj, binding.Query).

func (*Context) ShouldBindTOML

func (c *Context) ShouldBindTOML(obj any) error

ShouldBindTOML is a shortcut for c.ShouldBindWith(obj, binding.TOML).

func (*Context) ShouldBindUri

func (c *Context) ShouldBindUri(obj any) error

ShouldBindUri binds the passed struct pointer using the specified binding engine.

func (*Context) ShouldBindWith

func (c *Context) ShouldBindWith(obj any, b binding.Binding) error

func (*Context) ShouldBindXML

func (c *Context) ShouldBindXML(obj any) error

ShouldBindXML is a shortcut for c.ShouldBindWith(obj, binding.XML).

func (*Context) ShouldBindYAML

func (c *Context) ShouldBindYAML(obj any) error

ShouldBindYAML is a shortcut for c.ShouldBindWith(obj, binding.YAML).

func (*Context) Status

func (c *Context) Status(code int)

type Param

type Param struct {
	Key   string
	Value string
}

type Params

type Params []Param

func (Params) ByName

func (p Params) ByName(name string) (va string)

func (Params) Get

func (p Params) Get(key string) (string, bool)

type ResponseWriter

type ResponseWriter struct {
	http.ResponseWriter
	// contains filtered or unexported fields
}

func NewResponseWriter

func NewResponseWriter(w http.ResponseWriter) *ResponseWriter

func (*ResponseWriter) Size

func (w *ResponseWriter) Size() int

func (*ResponseWriter) Status

func (w *ResponseWriter) Status() int

func (*ResponseWriter) WriteHeader

func (w *ResponseWriter) WriteHeader(code int)

func (*ResponseWriter) WriteHeaderNow

func (w *ResponseWriter) WriteHeaderNow()

func (*ResponseWriter) Written

func (w *ResponseWriter) Written() bool

Jump to

Keyboard shortcuts

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