mirror of
https://github.com/kataras/iris.git
synced 2026-01-08 20:41:57 +00:00
CI: minor: use the new exclude-paths (dependabot PR approved some days ago)
This commit is contained in:
@@ -21,7 +21,7 @@ func Check(err error) error {
|
||||
// If "err" is *Group then it fires the "visitor" for each of its errors, including children.
|
||||
// if "err" is *Error then it fires the "visitor" with its type and wrapped error.
|
||||
// Otherwise it fires the "visitor" once with typ of nil and err as "err".
|
||||
func Walk(err error, visitor func(typ interface{}, err error)) error {
|
||||
func Walk(err error, visitor func(typ any, err error)) error {
|
||||
if err == nil {
|
||||
return nil
|
||||
}
|
||||
@@ -66,7 +66,7 @@ func Errors(err error, conv bool) []error {
|
||||
return []error{err}
|
||||
}
|
||||
|
||||
func Type(err error) interface{} {
|
||||
func Type(err error) any {
|
||||
if err == nil {
|
||||
return nil
|
||||
}
|
||||
@@ -95,8 +95,8 @@ func Fill(parent *Group, errors []*Error) {
|
||||
// It is a special error type which keep the "Type" of the
|
||||
// Group that it's created through Group's `Err` and `Errf` methods.
|
||||
type Error struct {
|
||||
Err error `json:"error" xml:"Error" yaml:"Error" toml:"Error" sql:"error"`
|
||||
Type interface{} `json:"type" xml:"Type" yaml:"Type" toml:"Type" sql:"type"`
|
||||
Err error `json:"error" xml:"Error" yaml:"Error" toml:"Error" sql:"error"`
|
||||
Type any `json:"type" xml:"Type" yaml:"Type" toml:"Type" sql:"type"`
|
||||
}
|
||||
|
||||
// Error returns the error message of the "Err".
|
||||
@@ -129,7 +129,7 @@ func (e *Error) Is(err error) bool {
|
||||
}
|
||||
|
||||
// As reports whether the "target" can be used as &Error{target.Type: ?}.
|
||||
func (e *Error) As(target interface{}) bool {
|
||||
func (e *Error) As(target any) bool {
|
||||
if target == nil {
|
||||
return target == e
|
||||
}
|
||||
@@ -157,10 +157,10 @@ func (e *Error) As(target interface{}) bool {
|
||||
type Group struct {
|
||||
parent *Group
|
||||
// a list of children groups, used to get or create new group through Group method.
|
||||
children map[interface{}]*Group
|
||||
children map[any]*Group
|
||||
depth int
|
||||
|
||||
Type interface{}
|
||||
Type any
|
||||
Errors []error // []*Error
|
||||
|
||||
// if true then this Group's Error method will return the messages of the errors made by this Group's Group method.
|
||||
@@ -171,7 +171,7 @@ type Group struct {
|
||||
}
|
||||
|
||||
// New returns a new empty Group.
|
||||
func New(typ interface{}) *Group {
|
||||
func New(typ any) *Group {
|
||||
return &Group{
|
||||
Type: typ,
|
||||
IncludeChildren: true,
|
||||
@@ -248,9 +248,9 @@ func (g *Group) Unwrap() error {
|
||||
}
|
||||
|
||||
// Group creates a new group of "typ" type, if does not exist, and returns it.
|
||||
func (g *Group) Group(typ interface{}) *Group {
|
||||
func (g *Group) Group(typ any) *Group {
|
||||
if g.children == nil {
|
||||
g.children = make(map[interface{}]*Group)
|
||||
g.children = make(map[any]*Group)
|
||||
} else {
|
||||
for _, child := range g.children {
|
||||
if child.Type == typ {
|
||||
@@ -282,7 +282,7 @@ func (g *Group) Add(err error) {
|
||||
}
|
||||
|
||||
// Addf adds an error to the group like `fmt.Errorf` and returns it.
|
||||
func (g *Group) Addf(format string, args ...interface{}) error {
|
||||
func (g *Group) Addf(format string, args ...any) error {
|
||||
err := fmt.Errorf(format, args...)
|
||||
g.Add(err)
|
||||
return err
|
||||
@@ -298,7 +298,7 @@ func (g *Group) Err(err error) error {
|
||||
if !ok {
|
||||
if ge, ok := err.(*Group); ok {
|
||||
if g.children == nil {
|
||||
g.children = make(map[interface{}]*Group)
|
||||
g.children = make(map[any]*Group)
|
||||
}
|
||||
|
||||
g.children[ge.Type] = ge
|
||||
@@ -314,7 +314,7 @@ func (g *Group) Err(err error) error {
|
||||
}
|
||||
|
||||
// Errf adds an error like `fmt.Errorf` and returns it.
|
||||
func (g *Group) Errf(format string, args ...interface{}) error {
|
||||
func (g *Group) Errf(format string, args ...any) error {
|
||||
return g.Err(fmt.Errorf(format, args...))
|
||||
}
|
||||
|
||||
|
||||
@@ -145,7 +145,7 @@ func TestGroup(t *testing.T) {
|
||||
|
||||
t.Run("Walk", func(t *testing.T) {
|
||||
expectedEntries := 4
|
||||
_ = Walk(g, func(typ interface{}, err error) {
|
||||
_ = Walk(g, func(typ any, err error) {
|
||||
g.IncludeChildren = false
|
||||
childAPIErrorsGroup.IncludeChildren = false
|
||||
childAPIErrorsGroup2.IncludeChildren = false
|
||||
|
||||
@@ -14,7 +14,7 @@ import (
|
||||
// .FromStd(h http.Handler)
|
||||
// .FromStd(func(w http.ResponseWriter, r *http.Request))
|
||||
// .FromStd(func(w http.ResponseWriter, r *http.Request, next http.HandlerFunc))
|
||||
func FromStd(handler interface{}) context.Handler {
|
||||
func FromStd(handler any) context.Handler {
|
||||
switch h := handler.(type) {
|
||||
case context.Handler:
|
||||
return h
|
||||
|
||||
@@ -18,13 +18,13 @@ type (
|
||||
// ValueSetter is the interface which can be accepted as a generic solution of RequestParams or memstore when Set is the only requirement,
|
||||
// i.e internally on macro/template/TemplateParam#Eval:paramChanger.
|
||||
ValueSetter interface {
|
||||
Set(key string, newValue interface{}) (Entry, bool)
|
||||
Set(key string, newValue any) (Entry, bool)
|
||||
}
|
||||
// Entry is the entry of the context storage Store - .Values()
|
||||
Entry struct {
|
||||
Key string `json:"key" msgpack:"key" yaml:"Key" toml:"Value"`
|
||||
ValueRaw interface{} `json:"value" msgpack:"value" yaml:"Value" toml:"Value"`
|
||||
immutable bool // if true then it can't change by its caller.
|
||||
Key string `json:"key" msgpack:"key" yaml:"Key" toml:"Value"`
|
||||
ValueRaw any `json:"value" msgpack:"value" yaml:"Value" toml:"Value"`
|
||||
immutable bool // if true then it can't change by its caller.
|
||||
}
|
||||
|
||||
// StringEntry is just a key-value wrapped by a struct.
|
||||
@@ -47,7 +47,7 @@ var _ ValueSetter = (*Store)(nil)
|
||||
//
|
||||
// If the "k" kind is not a string or int or int64 or bool
|
||||
// then it will return the raw value of the entry as it's.
|
||||
func (e Entry) GetByKindOrNil(k reflect.Kind) interface{} {
|
||||
func (e Entry) GetByKindOrNil(k reflect.Kind) any {
|
||||
switch k {
|
||||
case reflect.String:
|
||||
v := e.StringDefault("__$nf")
|
||||
@@ -136,7 +136,7 @@ func (e *ErrEntryNotFound) Error() string {
|
||||
// Do NOT use this method directly, prefer` errors.As` method as explained above.
|
||||
//
|
||||
// Implements: go/src/errors/wrap.go#84
|
||||
func (e *ErrEntryNotFound) As(target interface{}) bool {
|
||||
func (e *ErrEntryNotFound) As(target any) bool {
|
||||
v, ok := target.(*ErrEntryNotFound)
|
||||
if !ok {
|
||||
return false
|
||||
@@ -721,7 +721,7 @@ func (e Entry) WeekdayDefault(def time.Weekday) (time.Weekday, error) {
|
||||
|
||||
// Value returns the value of the entry,
|
||||
// respects the immutable.
|
||||
func (e Entry) Value() interface{} {
|
||||
func (e Entry) Value() any {
|
||||
if e.immutable {
|
||||
// take its value, no pointer even if set with a reference.
|
||||
vv := reflect.Indirect(reflect.ValueOf(e.ValueRaw))
|
||||
@@ -751,7 +751,7 @@ func (e Entry) Value() interface{} {
|
||||
//
|
||||
// Returns the entry and true if it was just inserted, meaning that
|
||||
// it will return the entry and a false boolean if the entry exists and it has been updated.
|
||||
func (r *Store) Save(key string, value interface{}, immutable bool) (Entry, bool) {
|
||||
func (r *Store) Save(key string, value any, immutable bool) (Entry, bool) {
|
||||
args := *r
|
||||
n := len(args)
|
||||
|
||||
@@ -802,7 +802,7 @@ func (r *Store) Save(key string, value interface{}, immutable bool) (Entry, bool
|
||||
// it will return the entry and a false boolean if the entry exists and it has been updated.
|
||||
//
|
||||
// See `SetImmutable` and `Get`.
|
||||
func (r *Store) Set(key string, value interface{}) (Entry, bool) {
|
||||
func (r *Store) Set(key string, value any) (Entry, bool) {
|
||||
return r.Save(key, value, false)
|
||||
}
|
||||
|
||||
@@ -817,7 +817,7 @@ func (r *Store) Set(key string, value interface{}) (Entry, bool) {
|
||||
//
|
||||
// Use it consistently, it's far slower than `Set`.
|
||||
// Read more about muttable and immutable go types: https://stackoverflow.com/a/8021081
|
||||
func (r *Store) SetImmutable(key string, value interface{}) (Entry, bool) {
|
||||
func (r *Store) SetImmutable(key string, value any) (Entry, bool) {
|
||||
return r.Save(key, value, true)
|
||||
}
|
||||
|
||||
@@ -851,7 +851,7 @@ func (r *Store) GetEntryAt(index int) (Entry, bool) {
|
||||
// GetDefault returns the entry's value based on its key.
|
||||
// If not found returns "def".
|
||||
// This function checks for immutability as well, the rest don't.
|
||||
func (r *Store) GetDefault(key string, def interface{}) interface{} {
|
||||
func (r *Store) GetDefault(key string, def any) any {
|
||||
v, ok := r.GetEntry(key)
|
||||
if !ok || v.ValueRaw == nil {
|
||||
return def
|
||||
@@ -874,14 +874,14 @@ func (r *Store) Exists(key string) bool {
|
||||
|
||||
// Get returns the entry's value based on its key.
|
||||
// If not found returns nil.
|
||||
func (r *Store) Get(key string) interface{} {
|
||||
func (r *Store) Get(key string) any {
|
||||
return r.GetDefault(key, nil)
|
||||
}
|
||||
|
||||
// GetOrSet is like `GetDefault` but it accepts a function which is
|
||||
// fired and its result is used to `Set` if
|
||||
// the "key" was not found or its value is nil.
|
||||
func (r *Store) GetOrSet(key string, setFunc func() interface{}) interface{} {
|
||||
func (r *Store) GetOrSet(key string, setFunc func() any) any {
|
||||
if v, ok := r.GetEntry(key); ok && v.ValueRaw != nil {
|
||||
return v.Value()
|
||||
}
|
||||
@@ -893,7 +893,7 @@ func (r *Store) GetOrSet(key string, setFunc func() interface{}) interface{} {
|
||||
|
||||
// Visit accepts a visitor which will be filled
|
||||
// by the key-value objects.
|
||||
func (r *Store) Visit(visitor func(key string, value interface{})) {
|
||||
func (r *Store) Visit(visitor func(key string, value any)) {
|
||||
args := *r
|
||||
for i, n := 0, len(args); i < n; i++ {
|
||||
kv := args[i]
|
||||
|
||||
@@ -150,7 +150,7 @@ func TestJSON(t *testing.T) {
|
||||
expected, got := p.Get(v.Key), v.ValueRaw
|
||||
|
||||
if ex, g := fmt.Sprintf("%v", expected), fmt.Sprintf("%v", got); ex != g {
|
||||
if _, isMap := got.(map[string]interface{}); isMap {
|
||||
if _, isMap := got.(map[string]any); isMap {
|
||||
// was struct but converted into map (as expected).
|
||||
b1, _ := json.Marshal(expected)
|
||||
b2, _ := json.Marshal(got)
|
||||
|
||||
@@ -360,7 +360,7 @@ func (api *APIBuilder) EnsureStaticBindings() Party {
|
||||
|
||||
// RegisterDependency calls the `ConfigureContainer.RegisterDependency` method
|
||||
// with the provided value(s). See `HandleFunc` and `PartyConfigure` methods too.
|
||||
func (api *APIBuilder) RegisterDependency(dependencies ...interface{}) {
|
||||
func (api *APIBuilder) RegisterDependency(dependencies ...any) {
|
||||
diContainer := api.ConfigureContainer()
|
||||
for i, dependency := range dependencies {
|
||||
if dependency == nil {
|
||||
@@ -442,7 +442,7 @@ func (api *APIBuilder) RegisterDependency(dependencies ...interface{}) {
|
||||
// the dependency injection, mvc and function handlers.
|
||||
//
|
||||
// This method is just a shortcut of the `ConfigureContainer().Handle`.
|
||||
func (api *APIBuilder) HandleFunc(method, relativePath string, handlersFn ...interface{}) *Route {
|
||||
func (api *APIBuilder) HandleFunc(method, relativePath string, handlersFn ...any) *Route {
|
||||
return api.ConfigureContainer().Handle(method, relativePath, handlersFn...)
|
||||
}
|
||||
|
||||
@@ -451,7 +451,7 @@ func (api *APIBuilder) HandleFunc(method, relativePath string, handlersFn ...int
|
||||
// or a result of <T> and/or an error.
|
||||
//
|
||||
// This method is just a shortcut of the `ConfigureContainer().Use`.
|
||||
func (api *APIBuilder) UseFunc(handlersFn ...interface{}) {
|
||||
func (api *APIBuilder) UseFunc(handlersFn ...any) {
|
||||
api.ConfigureContainer().Use(handlersFn...)
|
||||
}
|
||||
|
||||
@@ -636,7 +636,7 @@ func (api *APIBuilder) HandleMany(methodOrMulti string, relativePathorMulti stri
|
||||
//
|
||||
// Examples:
|
||||
// https://github.com/kataras/iris/tree/main/_examples/file-server
|
||||
func (api *APIBuilder) HandleDir(requestPath string, fsOrDir interface{}, opts ...DirOptions) (routes []*Route) {
|
||||
func (api *APIBuilder) HandleDir(requestPath string, fsOrDir any, opts ...DirOptions) (routes []*Route) {
|
||||
options := DefaultDirOptions
|
||||
if len(opts) > 0 {
|
||||
options = opts[0]
|
||||
@@ -1401,7 +1401,7 @@ func (api *APIBuilder) MiddlewareExists(handlerNameOrFunc any) bool {
|
||||
// Returns the Party itself for chain calls.
|
||||
//
|
||||
// Should be called before children routes regitration.
|
||||
func (api *APIBuilder) RemoveHandler(namesOrHandlers ...interface{}) Party {
|
||||
func (api *APIBuilder) RemoveHandler(namesOrHandlers ...any) Party {
|
||||
var counter *int
|
||||
|
||||
for _, nameOrHandler := range namesOrHandlers {
|
||||
|
||||
@@ -20,7 +20,7 @@ type APIContainer struct {
|
||||
|
||||
// Party returns a child of this `APIContainer` featured with Dependency Injection.
|
||||
// Like the `Self.Party` method does for the common Router Groups.
|
||||
func (api *APIContainer) Party(relativePath string, handlersFn ...interface{}) *APIContainer {
|
||||
func (api *APIContainer) Party(relativePath string, handlersFn ...any) *APIContainer {
|
||||
handlers := api.convertHandlerFuncs(relativePath, handlersFn...)
|
||||
p := api.Self.Party(relativePath, handlers...)
|
||||
return p.ConfigureContainer()
|
||||
@@ -67,7 +67,7 @@ func (api *APIContainer) OnError(errorHandler func(*context.Context, error)) {
|
||||
// - RegisterDependency(func(User) OtherResponse {...})
|
||||
//
|
||||
// See `OnError`, `Use`, `Done` and `Handle` too.
|
||||
func (api *APIContainer) RegisterDependency(dependency interface{}) *hero.Dependency {
|
||||
func (api *APIContainer) RegisterDependency(dependency any) *hero.Dependency {
|
||||
return api.Container.Register(dependency)
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ func (api *APIContainer) SetDependencyMatcher(fn hero.DependencyMatcher) *APICon
|
||||
}
|
||||
|
||||
// convertHandlerFuncs accepts Iris hero handlers and returns a slice of native Iris handlers.
|
||||
func (api *APIContainer) convertHandlerFuncs(relativePath string, handlersFn ...interface{}) context.Handlers {
|
||||
func (api *APIContainer) convertHandlerFuncs(relativePath string, handlersFn ...any) context.Handlers {
|
||||
fullpath := api.Self.GetRelPath() + relativePath
|
||||
paramsCount := macro.CountParams(fullpath, *api.Self.Macros())
|
||||
|
||||
@@ -136,7 +136,7 @@ func (api *APIContainer) convertHandlerFuncs(relativePath string, handlersFn ...
|
||||
return handlers
|
||||
}
|
||||
|
||||
func fixRouteInfo(route *Route, handlersFn []interface{}) {
|
||||
func fixRouteInfo(route *Route, handlersFn []any) {
|
||||
// Fix main handler name and source modified by execution rules wrapper.
|
||||
route.MainHandlerName, route.MainHandlerIndex = context.MainHandlerName(handlersFn...)
|
||||
if len(handlersFn) > route.MainHandlerIndex {
|
||||
@@ -147,7 +147,7 @@ func fixRouteInfo(route *Route, handlersFn []interface{}) {
|
||||
// Handler receives a function which can receive dependencies and output result
|
||||
// and returns a common Iris Handler, useful for Versioning API integration otherwise
|
||||
// the `Handle/Get/Post...` methods are preferable.
|
||||
func (api *APIContainer) Handler(handlerFn interface{}, handlerParamsCount int) context.Handler {
|
||||
func (api *APIContainer) Handler(handlerFn any, handlerParamsCount int) context.Handler {
|
||||
paramsCount := macro.CountParams(api.Self.GetRelPath(), *api.Self.Macros()) + handlerParamsCount
|
||||
return api.Container.HandlerWithParams(handlerFn, paramsCount)
|
||||
}
|
||||
@@ -155,14 +155,14 @@ func (api *APIContainer) Handler(handlerFn interface{}, handlerParamsCount int)
|
||||
// Use same as `Self.Use` but it accepts dynamic functions as its "handlersFn" input.
|
||||
//
|
||||
// See `OnError`, `RegisterDependency`, `Done` and `Handle` for more.
|
||||
func (api *APIContainer) Use(handlersFn ...interface{}) {
|
||||
func (api *APIContainer) Use(handlersFn ...any) {
|
||||
handlers := api.convertHandlerFuncs("/", handlersFn...)
|
||||
api.Self.Use(handlers...)
|
||||
}
|
||||
|
||||
// Done same as `Self.Done` but it accepts dynamic functions as its "handlersFn" input.
|
||||
// See `OnError`, `RegisterDependency`, `Use` and `Handle` for more.
|
||||
func (api *APIContainer) Done(handlersFn ...interface{}) {
|
||||
func (api *APIContainer) Done(handlersFn ...any) {
|
||||
handlers := api.convertHandlerFuncs("/", handlersFn...)
|
||||
api.Self.Done(handlers...)
|
||||
}
|
||||
@@ -178,7 +178,7 @@ func (api *APIContainer) Done(handlersFn ...interface{}) {
|
||||
// the end-developer should output an error and return `iris.ErrStopExecution`.
|
||||
//
|
||||
// See `OnError`, `RegisterDependency`, `Use`, `Done`, `Get`, `Post`, `Put`, `Patch` and `Delete` too.
|
||||
func (api *APIContainer) Handle(method, relativePath string, handlersFn ...interface{}) *Route {
|
||||
func (api *APIContainer) Handle(method, relativePath string, handlersFn ...any) *Route {
|
||||
handlers := api.convertHandlerFuncs(relativePath, handlersFn...)
|
||||
route := api.Self.Handle(method, relativePath, handlers...)
|
||||
fixRouteInfo(route, handlersFn)
|
||||
@@ -188,63 +188,63 @@ func (api *APIContainer) Handle(method, relativePath string, handlersFn ...inter
|
||||
// Get registers a route for the Get HTTP Method.
|
||||
//
|
||||
// Returns a *Route and an error which will be filled if route wasn't registered successfully.
|
||||
func (api *APIContainer) Get(relativePath string, handlersFn ...interface{}) *Route {
|
||||
func (api *APIContainer) Get(relativePath string, handlersFn ...any) *Route {
|
||||
return api.Handle(http.MethodGet, relativePath, handlersFn...)
|
||||
}
|
||||
|
||||
// Post registers a route for the Post HTTP Method.
|
||||
//
|
||||
// Returns a *Route and an error which will be filled if route wasn't registered successfully.
|
||||
func (api *APIContainer) Post(relativePath string, handlersFn ...interface{}) *Route {
|
||||
func (api *APIContainer) Post(relativePath string, handlersFn ...any) *Route {
|
||||
return api.Handle(http.MethodPost, relativePath, handlersFn...)
|
||||
}
|
||||
|
||||
// Put registers a route for the Put HTTP Method.
|
||||
//
|
||||
// Returns a *Route and an error which will be filled if route wasn't registered successfully.
|
||||
func (api *APIContainer) Put(relativePath string, handlersFn ...interface{}) *Route {
|
||||
func (api *APIContainer) Put(relativePath string, handlersFn ...any) *Route {
|
||||
return api.Handle(http.MethodPut, relativePath, handlersFn...)
|
||||
}
|
||||
|
||||
// Delete registers a route for the Delete HTTP Method.
|
||||
//
|
||||
// Returns a *Route and an error which will be filled if route wasn't registered successfully.
|
||||
func (api *APIContainer) Delete(relativePath string, handlersFn ...interface{}) *Route {
|
||||
func (api *APIContainer) Delete(relativePath string, handlersFn ...any) *Route {
|
||||
return api.Handle(http.MethodDelete, relativePath, handlersFn...)
|
||||
}
|
||||
|
||||
// Connect registers a route for the Connect HTTP Method.
|
||||
//
|
||||
// Returns a *Route and an error which will be filled if route wasn't registered successfully.
|
||||
func (api *APIContainer) Connect(relativePath string, handlersFn ...interface{}) *Route {
|
||||
func (api *APIContainer) Connect(relativePath string, handlersFn ...any) *Route {
|
||||
return api.Handle(http.MethodConnect, relativePath, handlersFn...)
|
||||
}
|
||||
|
||||
// Head registers a route for the Head HTTP Method.
|
||||
//
|
||||
// Returns a *Route and an error which will be filled if route wasn't registered successfully.
|
||||
func (api *APIContainer) Head(relativePath string, handlersFn ...interface{}) *Route {
|
||||
func (api *APIContainer) Head(relativePath string, handlersFn ...any) *Route {
|
||||
return api.Handle(http.MethodHead, relativePath, handlersFn...)
|
||||
}
|
||||
|
||||
// Options registers a route for the Options HTTP Method.
|
||||
//
|
||||
// Returns a *Route and an error which will be filled if route wasn't registered successfully.
|
||||
func (api *APIContainer) Options(relativePath string, handlersFn ...interface{}) *Route {
|
||||
func (api *APIContainer) Options(relativePath string, handlersFn ...any) *Route {
|
||||
return api.Handle(http.MethodOptions, relativePath, handlersFn...)
|
||||
}
|
||||
|
||||
// Patch registers a route for the Patch HTTP Method.
|
||||
//
|
||||
// Returns a *Route and an error which will be filled if route wasn't registered successfully.
|
||||
func (api *APIContainer) Patch(relativePath string, handlersFn ...interface{}) *Route {
|
||||
func (api *APIContainer) Patch(relativePath string, handlersFn ...any) *Route {
|
||||
return api.Handle(http.MethodPatch, relativePath, handlersFn...)
|
||||
}
|
||||
|
||||
// Trace registers a route for the Trace HTTP Method.
|
||||
//
|
||||
// Returns a *Route and an error which will be filled if route wasn't registered successfully.
|
||||
func (api *APIContainer) Trace(relativePath string, handlersFn ...interface{}) *Route {
|
||||
func (api *APIContainer) Trace(relativePath string, handlersFn ...any) *Route {
|
||||
return api.Handle(http.MethodTrace, relativePath, handlersFn...)
|
||||
}
|
||||
|
||||
@@ -258,7 +258,7 @@ func (api *APIContainer) Trace(relativePath string, handlersFn ...interface{}) *
|
||||
// Options
|
||||
// Connect
|
||||
// Trace
|
||||
func (api *APIContainer) Any(relativePath string, handlersFn ...interface{}) (routes []*Route) {
|
||||
func (api *APIContainer) Any(relativePath string, handlersFn ...any) (routes []*Route) {
|
||||
handlers := api.convertHandlerFuncs(relativePath, handlersFn...)
|
||||
|
||||
for _, m := range AllMethods {
|
||||
@@ -274,7 +274,7 @@ func (api *APIContainer) Any(relativePath string, handlersFn ...interface{}) (ro
|
||||
// OnErrorCode registers a handlers chain for this `Party` for a specific HTTP status code.
|
||||
// Read more at: http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml
|
||||
// Look `OnAnyErrorCode` too.
|
||||
func (api *APIContainer) OnErrorCode(statusCode int, handlersFn ...interface{}) []*Route {
|
||||
func (api *APIContainer) OnErrorCode(statusCode int, handlersFn ...any) []*Route {
|
||||
handlers := api.convertHandlerFuncs("/{tail:path}", handlersFn...)
|
||||
return api.Self.OnErrorCode(statusCode, handlers...)
|
||||
}
|
||||
@@ -282,7 +282,7 @@ func (api *APIContainer) OnErrorCode(statusCode int, handlersFn ...interface{})
|
||||
// OnAnyErrorCode registers a handlers chain for all error codes
|
||||
// (4xxx and 5xxx, change the `ClientErrorCodes` and `ServerErrorCodes` variables to modify those)
|
||||
// Look `OnErrorCode` too.
|
||||
func (api *APIContainer) OnAnyErrorCode(handlersFn ...interface{}) []*Route {
|
||||
func (api *APIContainer) OnAnyErrorCode(handlersFn ...any) []*Route {
|
||||
handlers := api.convertHandlerFuncs("/{tail:path}", handlersFn...)
|
||||
return api.Self.OnAnyErrorCode(handlers...)
|
||||
}
|
||||
|
||||
@@ -1199,7 +1199,7 @@ func (fi *fileInfo) Mode() os.FileMode { return fi.mode }
|
||||
func (fi *fileInfo) ModTime() time.Time { return fi.modTime }
|
||||
func (fi *fileInfo) IsDir() bool { return fi.isDir }
|
||||
func (fi *fileInfo) Size() int64 { return 0 }
|
||||
func (fi *fileInfo) Sys() interface{} { return fi }
|
||||
func (fi *fileInfo) Sys() any { return fi }
|
||||
|
||||
type dir struct {
|
||||
os.FileInfo // *fileInfo
|
||||
|
||||
@@ -33,7 +33,7 @@ type Party interface {
|
||||
EnsureStaticBindings() Party
|
||||
// RegisterDependency calls the `ConfigureContainer.RegisterDependency` method
|
||||
// with the provided value(s). See `HandleFunc` and `PartyConfigure` methods too.
|
||||
RegisterDependency(dependencies ...interface{})
|
||||
RegisterDependency(dependencies ...any)
|
||||
// HandleFunc registers a route on HTTP verb "method" and relative, to this Party, path.
|
||||
// It is like the `Handle` method but it accepts one or more "handlersFn" functions
|
||||
// that each one of them can accept any input arguments as the HTTP request and
|
||||
@@ -103,13 +103,13 @@ type Party interface {
|
||||
// the dependency injection, mvc and function handlers.
|
||||
//
|
||||
// This method is just a shortcut for the `ConfigureContainer().Handle` one.
|
||||
HandleFunc(method, relativePath string, handlersFn ...interface{}) *Route
|
||||
HandleFunc(method, relativePath string, handlersFn ...any) *Route
|
||||
// UseFunc registers a function which can accept one or more
|
||||
// dependencies (see RegisterDependency) and returns an iris.Handler
|
||||
// or a result of <T> and/or an error.
|
||||
//
|
||||
// This method is just a shortcut of the `ConfigureContainer().Use`.
|
||||
UseFunc(handlersFn ...interface{})
|
||||
UseFunc(handlersFn ...any)
|
||||
|
||||
// GetRelPath returns the current party's relative path.
|
||||
// i.e:
|
||||
@@ -245,7 +245,7 @@ type Party interface {
|
||||
// Returns the Party itself for chain calls.
|
||||
//
|
||||
// Should be called before children routes regitration.
|
||||
RemoveHandler(namesOrHandlers ...interface{}) Party
|
||||
RemoveHandler(namesOrHandlers ...any) Party
|
||||
// Reset removes all the begin and done handlers that may derived from the parent party via `Use` & `Done`,
|
||||
// and the execution rules.
|
||||
// Note that the `Reset` will not reset the handlers that are registered via `UseGlobal` & `DoneGlobal`.
|
||||
@@ -338,7 +338,7 @@ type Party interface {
|
||||
//
|
||||
// Examples:
|
||||
// https://github.com/kataras/iris/tree/main/_examples/file-server
|
||||
HandleDir(requestPath string, fileSystem interface{}, opts ...DirOptions) []*Route
|
||||
HandleDir(requestPath string, fileSystem any, opts ...DirOptions) []*Route
|
||||
|
||||
// None registers an "offline" route
|
||||
// see context.ExecRoute(routeName) and
|
||||
|
||||
@@ -335,7 +335,7 @@ func NewRoutePathReverser(apiRoutesProvider RoutesProvider, options ...RoutePath
|
||||
}
|
||||
|
||||
// Path returns a route path based on a route name and any dynamic named parameter's values-only.
|
||||
func (ps *RoutePathReverser) Path(routeName string, paramValues ...interface{}) string {
|
||||
func (ps *RoutePathReverser) Path(routeName string, paramValues ...any) string {
|
||||
r := ps.provider.GetRoute(routeName)
|
||||
if r == nil {
|
||||
return ""
|
||||
@@ -348,7 +348,7 @@ func (ps *RoutePathReverser) Path(routeName string, paramValues ...interface{})
|
||||
return r.ResolvePath(toStringSlice(paramValues)...)
|
||||
}
|
||||
|
||||
func toStringSlice(args []interface{}) (argsString []string) {
|
||||
func toStringSlice(args []any) (argsString []string) {
|
||||
argsSize := len(args)
|
||||
if argsSize <= 0 {
|
||||
return
|
||||
@@ -376,7 +376,7 @@ func toStringSlice(args []interface{}) (argsString []string) {
|
||||
// developers can just concat the subdomain, (host can be auto-retrieve by browser using the Path).
|
||||
|
||||
// URL same as Path but returns the full uri, i.e https://mysubdomain.mydomain.com/hello/iris
|
||||
func (ps *RoutePathReverser) URL(routeName string, paramValues ...interface{}) (url string) {
|
||||
func (ps *RoutePathReverser) URL(routeName string, paramValues ...any) (url string) {
|
||||
if ps.vhost == "" || ps.vscheme == "" {
|
||||
return "not supported"
|
||||
}
|
||||
|
||||
@@ -154,7 +154,7 @@ func (r *Route) UseOnce(handlers ...context.Handler) {
|
||||
// Returns the total amount of handlers removed.
|
||||
//
|
||||
// Should be called before Application Build.
|
||||
func (r *Route) RemoveHandler(namesOrHandlers ...interface{}) (count int) {
|
||||
func (r *Route) RemoveHandler(namesOrHandlers ...any) (count int) {
|
||||
for _, nameOrHandler := range namesOrHandlers {
|
||||
handlerName := ""
|
||||
switch h := nameOrHandler.(type) {
|
||||
@@ -644,7 +644,7 @@ func (rd routeReadOnlyWrapper) MainHandlerIndex() int {
|
||||
return rd.Route.MainHandlerIndex
|
||||
}
|
||||
|
||||
func (rd routeReadOnlyWrapper) Property(key string) (interface{}, bool) {
|
||||
func (rd routeReadOnlyWrapper) Property(key string) (any, bool) {
|
||||
properties := rd.Route.Party.Properties()
|
||||
if properties != nil {
|
||||
if property, ok := properties[key]; ok {
|
||||
|
||||
Reference in New Issue
Block a user