Documentation ¶
Index ¶
- func AuthBearer(h http.Header) (string, bool, error)
- func AuthDelete[Account any, Session any, RequestData any, ResponseData any](ctx *AuthContext[Account, Session], url string, ...)
- func AuthGet[Account any, Session any, RequestData any, ResponseData any](ctx *AuthContext[Account, Session], url string, ...)
- func AuthHandle[Account any, Session any, RequestData any, ResponseData any](ctx *AuthContext[Account, Session], method string, url string, ...)
- func AuthJwt[Account any, Session any](jwt *ujwt.Jwt[Account, Session], validate func(Session, string) error) func(http.Header) (Account, Session, bool, error)
- func AuthKey[Account any, Session any](name string, f func(string) (Account, error)) func(http.Header) (Account, Session, bool, error)
- func AuthPost[Account any, Session any, RequestData any, ResponseData any](ctx *AuthContext[Account, Session], url string, ...)
- func AuthPut[Account any, Session any, RequestData any, ResponseData any](ctx *AuthContext[Account, Session], url string, ...)
- func AuthToken(h http.Header, name string) (token string, present bool, err error)
- func Delete[RequestData any, ResponseData any](ctx *Context, url string, ...)
- func Get[RequestData any, ResponseData any](ctx *Context, url string, ...)
- func Handle[RequestData any, ResponseData any](ctx *Context, method string, url string, ...)
- func Post[RequestData any, ResponseData any](ctx *Context, url string, ...)
- func Put[RequestData any, ResponseData any](ctx *Context, url string, ...)
- func Trace[RequestData any, ResponseData any](ctx *Context, r Request[RequestData], w Response[ResponseData], ...)
- type AuthContext
- func (o *AuthContext[Account, Session]) AppendAuth(auth func(h http.Header) (Account, Session, bool, error)) *AuthContext[Account, Session]
- func (o *AuthContext[Account, Session]) Auth(h http.Header) (account Account, session Session, err error)
- func (o AuthContext[Account, Session]) Branch(name string) *AuthContext[Account, Session]
- func (o AuthContext[Account, Session]) Router() *uhttp.Router
- type AuthRequest
- type Context
- func (o *Context) AllowCors(v bool) *Context
- func (o Context) Branch(name string) *Context
- func (o *Context) Log() *ulog.Log
- func (o *Context) ReverseProxy(path string, proxy *uhttp.ReverseProxy)
- func (o *Context) Router() *uhttp.Router
- func (o *Context) Trace(v uhttp.FormatProvider, ok bool)
- func (o *Context) WithFormat(f uhttp.Format) *Context
- func (o *Context) WithFormatError(f uhttp.Format) *Context
- type Image
- type Request
- func (o Request[T]) ClientAddr() string
- func (o Request[T]) ClientHost() string
- func (o *Request[T]) DataFromJson() error
- func (o *Request[T]) DataFromParams() error
- func (o Request[T]) EmptyData() bool
- func (o Request[T]) HasBody() bool
- func (o Request[T]) HeaderString() string
- func (o Request[T]) Param(name string) string
- func (o Request[T]) ParamBool(name string) (bool, error)
- func (o Request[T]) ParamBoolDef(name string) (r bool, err error)
- func (o Request[T]) ParamExists(name string) bool
- func (o Request[T]) ParamInt(name string) (int, error)
- func (o Request[T]) ParamInt64(name string) (int64, error)
- func (o Request[T]) ParamUuid(name string) (uuid.UUID, error)
- func (o Request[T]) Params(v any) error
- func (o Request[T]) RemoteAddr() string
- func (o Request[T]) RemoteHost() string
- func (o Request[T]) Var(name string) string
- func (o Request[T]) VarInt(name string) (int, error)
- func (o Request[T]) VarInt64(name string) (int64, error)
- func (o Request[T]) VarInt64Def(name string) int64
- func (o Request[T]) VarIntDef(name string) int
- func (o Request[T]) VarUuid(name string) (uuid.UUID, error)
- type Response
- func (o *Response[T]) BadRequest(s string)
- func (o *Response[T]) BadRequestf(s string, args ...any)
- func (o *Response[T]) EmptyData() bool
- func (o *Response[T]) Forbidden(s string)
- func (o *Response[T]) Forbiddenf(s string, args ...any)
- func (o *Response[T]) MuteError()
- func (o *Response[T]) NotAcceptable(s string)
- func (o *Response[T]) NotAcceptablef(s string, args ...any)
- func (o *Response[T]) NotFound(s string)
- func (o *Response[T]) NotImplemented(s string)
- func (o *Response[T]) NotImplementedf(s string, args ...any)
- func (o *Response[T]) NotTrace()
- func (o *Response[T]) Ok() bool
- func (o *Response[T]) RefineBadRequest(prefix string) bool
- func (o *Response[T]) RefineError(prefix string) bool
- func (o *Response[T]) RefineErrorf(s string, args ...any) bool
- func (o *Response[T]) ServiceUnavailable(s string)
- func (o *Response[T]) ServiceUnavailablef(s string, args ...any)
- func (o *Response[T]) SetBadRequest()
- func (o *Response[T]) SetForbidden()
- func (o *Response[T]) SetNotAcceptable()
- func (o *Response[T]) SetNotFound()
- func (o *Response[T]) SetNotImplemented()
- func (o *Response[T]) SetServiceUnavailable()
- func (o *Response[T]) SetUnauthorized()
- func (o *Response[T]) Unauthorized(s string)
- func (o *Response[T]) Unauthorizedf(s string, args ...any)
- type Text
- type Void
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AuthDelete ¶ added in v0.5.3
func AuthDelete[Account any, Session any, RequestData any, ResponseData any]( ctx *AuthContext[Account, Session], url string, handle func(AuthRequest[Account, Session, RequestData], *Response[ResponseData]), )
func AuthGet ¶ added in v0.5.3
func AuthGet[Account any, Session any, RequestData any, ResponseData any]( ctx *AuthContext[Account, Session], url string, handle func(AuthRequest[Account, Session, RequestData], *Response[ResponseData]), )
func AuthHandle ¶ added in v0.5.3
func AuthHandle[Account any, Session any, RequestData any, ResponseData any]( ctx *AuthContext[Account, Session], method string, url string, handle func(AuthRequest[Account, Session, RequestData], *Response[ResponseData]), )
func AuthPost ¶ added in v0.5.3
func AuthPost[Account any, Session any, RequestData any, ResponseData any]( ctx *AuthContext[Account, Session], url string, handle func(AuthRequest[Account, Session, RequestData], *Response[ResponseData]), )
func AuthPut ¶ added in v0.5.3
func AuthPut[Account any, Session any, RequestData any, ResponseData any]( ctx *AuthContext[Account, Session], url string, handle func(AuthRequest[Account, Session, RequestData], *Response[ResponseData]), )
Types ¶
type AuthContext ¶ added in v0.5.3
type AuthContext[Account any, Session any] struct { Base *Context // contains filtered or unexported fields }
func NewAuthContext ¶ added in v0.5.3
func (*AuthContext[Account, Session]) AppendAuth ¶ added in v0.5.3
func (o *AuthContext[Account, Session]) AppendAuth(auth func(h http.Header) (Account, Session, bool, error)) *AuthContext[Account, Session]
func (*AuthContext[Account, Session]) Auth ¶ added in v0.5.3
func (o *AuthContext[Account, Session]) Auth(h http.Header) (account Account, session Session, err error)
func (AuthContext[Account, Session]) Branch ¶ added in v0.5.3
func (o AuthContext[Account, Session]) Branch(name string) *AuthContext[Account, Session]
func (AuthContext[Account, Session]) Router ¶ added in v0.5.9
func (o AuthContext[Account, Session]) Router() *uhttp.Router
type AuthRequest ¶ added in v0.5.3
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
func NewContext ¶
func (*Context) ReverseProxy ¶ added in v0.7.9
func (o *Context) ReverseProxy(path string, proxy *uhttp.ReverseProxy)
type Request ¶
type Request[T any] struct { Data T // contains filtered or unexported fields }
func (Request[T]) ClientAddr ¶
func (Request[T]) ClientHost ¶
func (*Request[T]) DataFromJson ¶ added in v0.5.3
func (*Request[T]) DataFromParams ¶
func (Request[T]) HeaderString ¶ added in v0.5.3
func (Request[T]) ParamExists ¶
func (Request[T]) RemoteAddr ¶
func (Request[T]) RemoteHost ¶
func (Request[T]) VarInt64Def ¶
type Response ¶ added in v0.7.9
type Response[T any] struct { Status int Data T Error error ErrorCode int // contains filtered or unexported fields }
func (*Response[T]) BadRequest ¶ added in v0.7.9
func (*Response[T]) BadRequestf ¶ added in v0.7.9
func (*Response[T]) Forbiddenf ¶ added in v0.7.9
func (*Response[T]) NotAcceptable ¶ added in v0.7.9
func (*Response[T]) NotAcceptablef ¶ added in v0.7.9
func (*Response[T]) NotImplemented ¶ added in v0.7.9
func (*Response[T]) NotImplementedf ¶ added in v0.7.9
func (*Response[T]) RefineBadRequest ¶ added in v0.7.9
func (*Response[T]) RefineError ¶ added in v0.7.9
func (*Response[T]) RefineErrorf ¶ added in v0.7.9
func (*Response[T]) ServiceUnavailable ¶ added in v0.7.9
func (*Response[T]) ServiceUnavailablef ¶ added in v0.7.9
func (*Response[T]) SetBadRequest ¶ added in v0.7.9
func (o *Response[T]) SetBadRequest()
func (*Response[T]) SetForbidden ¶ added in v0.7.9
func (o *Response[T]) SetForbidden()
func (*Response[T]) SetNotAcceptable ¶ added in v0.7.9
func (o *Response[T]) SetNotAcceptable()
func (*Response[T]) SetNotFound ¶ added in v0.7.9
func (o *Response[T]) SetNotFound()
func (*Response[T]) SetNotImplemented ¶ added in v0.7.9
func (o *Response[T]) SetNotImplemented()
func (*Response[T]) SetServiceUnavailable ¶ added in v0.7.9
func (o *Response[T]) SetServiceUnavailable()
func (*Response[T]) SetUnauthorized ¶ added in v0.7.9
func (o *Response[T]) SetUnauthorized()
func (*Response[T]) Unauthorized ¶ added in v0.7.9
func (*Response[T]) Unauthorizedf ¶ added in v0.7.9
Click to show internal directories.
Click to hide internal directories.