1
0
mirror of https://github.com/kataras/iris.git synced 2026-06-10 07:33:42 +00:00

update dependencies

This commit is contained in:
Gerasimos (Makis) Maropoulos
2025-08-15 23:29:20 +03:00
parent de4f462198
commit a8a3afea22
186 changed files with 694 additions and 689 deletions
+1 -1
View File
@@ -17,7 +17,7 @@ jobs:
strategy:
matrix:
go_version: [1.24.x]
go_version: [1.25.x]
steps:
- name: Check out code into the Go module directory
+24 -24
View File
@@ -197,7 +197,7 @@ type BaseController struct {
Ctx iris.Context
}
func (c *BaseController) GetDoSomething(i interface{}) error {
func (c *BaseController) GetDoSomething(i any) error {
return nil
}
@@ -465,7 +465,7 @@ stage.Get/Post...
- Add the ability to [share functions](https://github.com/kataras/iris/tree/main/_examples/routing/writing-a-middleware/share-funcs) between handlers chain and add an [example](https://github.com/kataras/iris/tree/main/_examples/routing/writing-a-middleware/share-services) on sharing Go structures (aka services).
- Add the new `Party.UseOnce` method to the `*Route`
- Add a new `*Route.RemoveHandler(...interface{}) int` and `Party.RemoveHandler(...interface{}) Party` methods, delete a handler based on its name or the handler pc function.
- Add a new `*Route.RemoveHandler(...any) int` and `Party.RemoveHandler(...any) Party` methods, delete a handler based on its name or the handler pc function.
```go
func middleware(ctx iris.Context) {
@@ -716,7 +716,7 @@ var dirOpts = iris.DirOptions{
- New `iris.WithLowercaseRouting` option which forces all routes' paths to be lowercase and converts request paths to their lowercase for matching.
- New `app.Validator { Struct(interface{}) error }` field and `app.Validate` method were added. The `app.Validator = ` can be used to integrate a 3rd-party package such as [go-playground/validator](https://github.com/go-playground/validator). If set-ed then Iris `Context`'s `ReadJSON`, `ReadXML`, `ReadMsgPack`, `ReadYAML`, `ReadForm`, `ReadQuery`, `ReadBody` methods will return the validation error on data validation failures. The [read-json-struct-validation](_examples/request-body/read-json-struct-validation) example was updated.
- New `app.Validator { Struct(any) error }` field and `app.Validate` method were added. The `app.Validator = ` can be used to integrate a 3rd-party package such as [go-playground/validator](https://github.com/go-playground/validator). If set-ed then Iris `Context`'s `ReadJSON`, `ReadXML`, `ReadMsgPack`, `ReadYAML`, `ReadForm`, `ReadQuery`, `ReadBody` methods will return the validation error on data validation failures. The [read-json-struct-validation](_examples/request-body/read-json-struct-validation) example was updated.
- A result of <T> can implement the new `hero.PreflightResult` interface which contains a single method of `Preflight(iris.Context) error`. If this method exists on a custom struct value which is returned from a handler then it will fire that `Preflight` first and if not errored then it will cotninue by sending the struct value as JSON(by-default) response body.
@@ -743,17 +743,17 @@ var dirOpts = iris.DirOptions{
## New Context Methods
- `Context.FormFiles(key string, before ...func(*Context, *multipart.FileHeader) bool) (files []multipart.File, headers []*multipart.FileHeader, err error)` method.
- `Context.ReadURL(ptr interface{}) error` shortcut of `ReadParams` and `ReadQuery`. Binds URL dynamic path parameters and URL query parameters to the given "ptr" pointer of a struct value.
- `Context.ReadURL(ptr any) error` shortcut of `ReadParams` and `ReadQuery`. Binds URL dynamic path parameters and URL query parameters to the given "ptr" pointer of a struct value.
- `Context.SetUser(User)` and `Context.User() User` to store and retrieve an authenticated client. Read more [here](https://github.com/iris-contrib/middleware/issues/63).
- `Context.SetLogoutFunc(fn interface{}, persistenceArgs ...interface{})` and `Logout(args ...interface{}) error` methods to allow different kind of auth middlewares to be able to set a "logout" a user/client feature with a single function, the route handler may not be aware of the implementation of the authentication used.
- `Context.SetFunc(name string, fn interface{}, persistenceArgs ...interface{})` and `Context.CallFunc(name string, args ...interface{}) ([]reflect.Value, error)` to allow middlewares to share functions dynamically when the type of the function is not predictable, see the [example](https://github.com/kataras/iris/tree/main/_examples/routing/writing-a-middleware/share-funcs) for more.
- `Context.TextYAML(interface{}) error` same as `Context.YAML` but with set the Content-Type to `text/yaml` instead (Google Chrome renders it as text).
- `Context.SetLogoutFunc(fn any, persistenceArgs ...any)` and `Logout(args ...any) error` methods to allow different kind of auth middlewares to be able to set a "logout" a user/client feature with a single function, the route handler may not be aware of the implementation of the authentication used.
- `Context.SetFunc(name string, fn any, persistenceArgs ...any)` and `Context.CallFunc(name string, args ...any) ([]reflect.Value, error)` to allow middlewares to share functions dynamically when the type of the function is not predictable, see the [example](https://github.com/kataras/iris/tree/main/_examples/routing/writing-a-middleware/share-funcs) for more.
- `Context.TextYAML(any) error` same as `Context.YAML` but with set the Content-Type to `text/yaml` instead (Google Chrome renders it as text).
- `Context.IsDebug() bool` reports whether the application is running under debug/development mode. It is a shortcut of Application.Logger().Level >= golog.DebugLevel.
- `Context.IsRecovered() bool` reports whether the current request was recovered from the [recover middleware](https://github.com/kataras/iris/tree/main/middleware/recover). Also the `Context.GetErrPublic() (bool, error)`, `Context.SetErrPrivate(err error)` methods and `iris.ErrPrivate` interface have been introduced.
- `Context.RecordRequestBody(bool)` same as the Application's `DisableBodyConsumptionOnUnmarshal` configuration field but registers per chain of handlers. It makes the request body readable more than once.
- `Context.IsRecordingBody() bool` reports whether the request body can be readen multiple times.
- `Context.ReadHeaders(ptr interface{}) error` binds request headers to "ptr". [Example](https://github.com/kataras/iris/blob/main/_examples/request-body/read-headers/main.go).
- `Context.ReadParams(ptr interface{}) error` binds dynamic path parameters to "ptr". [Example](https://github.com/kataras/iris/blob/main/_examples/request-body/read-params/main.go).
- `Context.ReadHeaders(ptr any) error` binds request headers to "ptr". [Example](https://github.com/kataras/iris/blob/main/_examples/request-body/read-headers/main.go).
- `Context.ReadParams(ptr any) error` binds dynamic path parameters to "ptr". [Example](https://github.com/kataras/iris/blob/main/_examples/request-body/read-params/main.go).
- `Context.SaveFormFile(fh *multipart.FileHeader, dest string) (int64, error)` previously unexported. Accepts a result file of `Context.FormFile` and saves it to the disk.
- `Context.URLParamSlice(name string) []string` is a a shortcut of `ctx.Request().URL.Query()[name]`. Like `URLParam` but it returns all values as a string slice instead of a single string separated by commas. Note that it skips any empty values (e.g. https://iris-go.com?values=).
- `Context.PostValueMany(name string) (string, error)` returns the post data of a given key. The returned value is a single string separated by commas on multiple values. It also reports whether the form was empty or when the "name" does not exist or whether the available values are empty. It strips any empty key-values from the slice before return. See `ErrEmptyForm`, `ErrNotFound` and `ErrEmptyFormField` respectfully. The `PostValueInt`, `PostValueInt64`, `PostValueFloat64` and `PostValueBool` now respect the above errors too (the `PostValues` method now returns a second output argument of `error` too, see breaking changes below).
@@ -765,8 +765,8 @@ var dirOpts = iris.DirOptions{
- `Context.IsCanceled() bool` reports whether the request has been canceled by the client.
- `Context.IsSSL() bool` reports whether the request is under HTTPS SSL (New `Configuration.SSLProxyHeaders` and `HostProxyHeaders` fields too).
- `Context.CompressReader(enable bool)` method and `iris.CompressReader` middleware to enable future request read body calls to decompress data, [example](_examples/compression/main.go).
- `Context.RegisterDependency(v interface{})` and `Context.UnregisterDependency(typ reflect.Type)` to register/remove struct dependencies on serve-time through a middleware.
- `Context.SetID(id interface{})` and `Context.GetID() interface{}` added to register a custom unique indetifier to the Context, if necessary.
- `Context.RegisterDependency(v any)` and `Context.UnregisterDependency(typ reflect.Type)` to register/remove struct dependencies on serve-time through a middleware.
- `Context.SetID(id any)` and `Context.GetID() any` added to register a custom unique indetifier to the Context, if necessary.
- `Context.Scheme() string` returns the full scheme of the request URL.
- `Context.SubdomainFull() string` returns the full subdomain(s) part of the host (`host[0:rootLevelDomain]`).
- `Context.Domain() string` returns the root level domain.
@@ -778,12 +778,12 @@ var dirOpts = iris.DirOptions{
- `Context.IsGRPC() bool` reports whether the request came from a gRPC client
- `Context.UpsertCookie(*http.Cookie, cookieOptions ...context.CookieOption)` upserts a cookie, fixes [#1485](https://github.com/kataras/iris/issues/1485) too
- `Context.StopWithStatus(int)` stops the handlers chain and writes the status code
- `StopWithText(statusCode int, format string, args ...interface{})` stops the handlers chain, writes thre status code and a plain text message
- `StopWithText(statusCode int, format string, args ...any)` stops the handlers chain, writes thre status code and a plain text message
- `Context.StopWithError(int, error)` stops the handlers chain, writes thre status code and the error's message
- `Context.StopWithJSON(int, interface{})` stops the handlers chain, writes the status code and sends a JSON response
- `Context.StopWithJSON(int, any)` stops the handlers chain, writes the status code and sends a JSON response
- `Context.StopWithProblem(int, iris.Problem)` stops the handlers, writes the status code and sends an `application/problem+json` response
- `Context.Protobuf(proto.Message)` sends protobuf to the client (note that the `Context.JSON` is able to send protobuf as JSON)
- `Context.MsgPack(interface{})` sends msgpack format data to the client
- `Context.MsgPack(any)` sends msgpack format data to the client
- `Context.ReadProtobuf(ptr)` binds request body to a proto message
- `Context.ReadJSONProtobuf(ptr, ...options)` binds JSON request body to a proto message
- `Context.ReadMsgPack(ptr)` binds request body of a msgpack format to a struct
@@ -801,7 +801,7 @@ The most common scenario from a route to handle is to:
- accept one or more path parameters and request data, a payload
- send back a response, a payload (JSON, XML,...)
The new Iris Dependency Injection feature is about **33.2% faster** than its predecessor on the above case. This drops down even more the performance cost between native handlers and dynamic handlers with dependencies. This reason itself brings us, with safety and performance-wise, to the new `Party.ConfigureContainer(builder ...func(*iris.APIContainer)) *APIContainer` method which returns methods such as `Handle(method, relativePath string, handlersFn ...interface{}) *Route` and `RegisterDependency`.
The new Iris Dependency Injection feature is about **33.2% faster** than its predecessor on the above case. This drops down even more the performance cost between native handlers and dynamic handlers with dependencies. This reason itself brings us, with safety and performance-wise, to the new `Party.ConfigureContainer(builder ...func(*iris.APIContainer)) *APIContainer` method which returns methods such as `Handle(method, relativePath string, handlersFn ...any) *Route` and `RegisterDependency`.
Look how clean your codebase can be when using Iris':
@@ -869,7 +869,7 @@ OnError(errorHandler func(iris.Context, error))
// - RegisterDependency(loggerService{prefix: "dev"})
// - RegisterDependency(func(ctx iris.Context) User {...})
// - RegisterDependency(func(User) OtherResponse {...})
RegisterDependency(dependency interface{})
RegisterDependency(dependency any)
// UseResultHandler adds a result handler to the Container.
// A result handler can be used to inject the returned struct value
@@ -880,15 +880,15 @@ UseResultHandler(handler func(next iris.ResultHandler) iris.ResultHandler)
<details><summary>ResultHandler</summary>
```go
type ResultHandler func(ctx iris.Context, v interface{}) error
type ResultHandler func(ctx iris.Context, v any) error
```
</details>
```go
// Use same as a common Party's "Use" but it accepts dynamic functions as its "handlersFn" input.
Use(handlersFn ...interface{})
Use(handlersFn ...any)
// Done same as a common Party's but it accepts dynamic functions as its "handlersFn" input.
Done(handlersFn ...interface{})
Done(handlersFn ...any)
```
```go
@@ -901,10 +901,10 @@ Done(handlersFn ...interface{})
// the "handlersFn" will call `ctx.Next()` automatically when not called manually.
// To stop the execution and not continue to the next "handlersFn"
// the end-developer should output an error and return `iris.ErrStopExecution`.
Handle(method, relativePath string, handlersFn ...interface{}) *Route
Handle(method, relativePath string, handlersFn ...any) *Route
// Get registers a GET route, same as `Handle("GET", relativePath, handlersFn....)`.
Get(relativePath string, handlersFn ...interface{}) *Route
Get(relativePath string, handlersFn ...any) *Route
// and so on...
```
@@ -1163,7 +1163,7 @@ Response:
- `Context.ServeContent` no longer returns an error, see `ServeContentWithRate`, `ServeFileWithRate` and `SendFileWithRate` new methods too.
- `route.Trace() string` changed to `route.Trace(w io.Writer)`, to achieve the same result just pass a `bytes.Buffer`
- `var mvc.AutoBinding` removed as the default behavior now resolves such dependencies automatically (see [[FEATURE REQUEST] MVC serving gRPC-compatible controller](https://github.com/kataras/iris/issues/1449)).
- `mvc#Application.SortByNumMethods()` removed as the default behavior now binds the "thinnest" empty `interface{}` automatically (see [MVC: service injecting fails](https://github.com/kataras/iris/issues/1343)).
- `mvc#Application.SortByNumMethods()` removed as the default behavior now binds the "thinnest" empty `any` automatically (see [MVC: service injecting fails](https://github.com/kataras/iris/issues/1343)).
- `mvc#BeforeActivation.Dependencies().Add` should be replaced with `mvc#BeforeActivation.Dependencies().Register` instead
- **REMOVE** the `kataras/iris/v12/typescript` package in favor of the new [iris-cli](https://github.com/kataras/iris-cli). Also, the alm typescript online editor was removed as it is deprecated by its author, please consider using the [designtsx](https://designtsx.com/) instead.
@@ -1312,7 +1312,7 @@ The iris-contrib/middleare and examples are updated to use the new `github.com/k
- Set `Cookie.SameSite` to `Lax` when subdomains sessions share is enabled[*](https://github.com/kataras/iris/commit/6bbdd3db9139f9038641ce6f00f7b4bab6e62550)
- Add and update all [experimental handlers](https://github.com/iris-contrib/middleware)
- New `XMLMap` function which wraps a `map[string]interface{}` and converts it to a valid xml content to render through `Context.XML` method
- New `XMLMap` function which wraps a `map[string]any` and converts it to a valid xml content to render through `Context.XML` method
- Add new `ProblemOptions.XML` and `RenderXML` fields to render the `Problem` as XML(application/problem+xml) instead of JSON("application/problem+json) and enrich the `Negotiate` to easily accept the `application/problem+xml` mime.
Commit log: https://github.com/kataras/iris/compare/v11.2.7...v11.2.8
@@ -1386,7 +1386,7 @@ app.Get("/path", func(ctx iris.Context){
```
- Add `Session.Len() int` to return the total number of stored values/entries.
- Make `Context.HTML` and `Context.Text` to accept an optional, variadic, `args ...interface{}` input arg(s) too.
- Make `Context.HTML` and `Context.Text` to accept an optional, variadic, `args ...any` input arg(s) too.
## v11.1.1
+1 -1
View File
@@ -1,6 +1,6 @@
module myapp
go 1.24.3
go 1.25
require (
github.com/go-sql-driver/mysql v1.9.2
+1 -1
View File
@@ -45,7 +45,7 @@ func main() {
}
// Validate a user from database.
allowFunc := func(ctx iris.Context, username, password string) (interface{}, bool) {
allowFunc := func(ctx iris.Context, username, password string) (any, bool) {
user, err := db.getUserByUsernameAndPassword(context.Background(), username, password)
return user, err == nil
}
+1 -1
View File
@@ -38,7 +38,7 @@ func main() {
},
// The users can be a slice of custom users structure
// or a map[string]string (username:password)
// or []map[string]interface{} with username and passwords required fields,
// or []map[string]any with username and passwords required fields,
// read the godocs for more.
Allow: basicauth.AllowUsers(users),
}
+1 -1
View File
@@ -44,7 +44,7 @@ func main() {
//
// And then register it:
verifier.Blocklist = blocklist
verifyMiddleware := verifier.Verify(func() interface{} {
verifyMiddleware := verifier.Verify(func() any {
return new(userClaims)
})
+1 -1
View File
@@ -34,7 +34,7 @@ func main() {
verifier.WithDefaultBlocklist()
// Enable payload decryption with:
// verifier.WithDecryption(encKey, nil)
verifyMiddleware := verifier.Verify(func() interface{} {
verifyMiddleware := verifier.Verify(func() any {
return new(fooClaims)
})
+1 -1
View File
@@ -66,7 +66,7 @@ func main() {
protectedAPI := app.Party("/protected")
{
verifyMiddleware := verifier.Verify(func() interface{} {
verifyMiddleware := verifier.Verify(func() any {
return new(UserClaims)
})
+1 -1
View File
@@ -46,7 +46,7 @@ func Verify() iris.Handler {
verifier := jwt.NewVerifier(jwt.HS256, []byte(secret), jwt.Expected{Issuer: util.AppName})
verifier.Extractors = []jwt.TokenExtractor{jwt.FromHeader} // extract token only from Authorization: Bearer $token
return verifier.Verify(func() interface{} {
return verifier.Verify(func() any {
return new(UserClaims)
})
}
@@ -60,7 +60,7 @@ func Do(method, url string, body io.Reader, opts ...RequestOption) (*http.Respon
}
// JSON fires a request with "v" as client json data.
func JSON(method, url string, v interface{}, opts ...RequestOption) (*http.Response, error) {
func JSON(method, url string, v any, opts ...RequestOption) (*http.Response, error) {
buf := new(bytes.Buffer)
err := json.NewEncoder(buf).Encode(v)
if err != nil {
@@ -85,7 +85,7 @@ func Form(method, url string, formData url.Values, opts ...RequestOption) (*http
}
// BindResponse binds a response body to the "dest" pointer and closes the body.
func BindResponse(resp *http.Response, dest interface{}) error {
func BindResponse(resp *http.Response, dest any) error {
contentType := resp.Header.Get("Content-Type")
if idx := strings.IndexRune(contentType, ';'); idx > 0 {
contentType = contentType[0:idx]
+1 -1
View File
@@ -1,6 +1,6 @@
module myapp
go 1.24.3
go 1.25
require (
github.com/google/uuid v1.6.0
+1 -1
View File
@@ -1,6 +1,6 @@
module github.com/kataras/iris/v12/_examples/bootstrapper
go 1.24.3
go 1.25
require (
github.com/gorilla/securecookie v1.1.2
+1 -1
View File
@@ -22,7 +22,7 @@ func TestApp(t *testing.T) {
// test not found
e.GET("/notfound").Expect().Status(httptest.StatusNotFound)
expectedErr := map[string]interface{}{
expectedErr := map[string]any{
"app": app.AppName,
"status": httptest.StatusNotFound,
"message": "",
+1 -1
View File
@@ -55,7 +55,7 @@ func TestCompressionBeforeRecorder(t *testing.T) {
testBody(t, e.GET("/"), expectedReply)
}
func testBody(t *testing.T, req *httptest.Request, expectedReply interface{}) {
func testBody(t *testing.T, req *httptest.Request, expectedReply any) {
t.Helper()
body := req.WithHeader(context.AcceptEncodingHeaderKey, context.GZIP).Expect().
@@ -1,6 +1,6 @@
module github.com/kataras/my-iris-app
go 1.24.3
go 1.25
require (
github.com/kataras/iris/v12 v12.2.11-0.20250430051100-af9c8213980c
+1 -1
View File
@@ -1,6 +1,6 @@
module app
go 1.24.3
go 1.25
require (
github.com/kataras/iris/v12 v12.2.11-0.20250430051100-af9c8213980c
+1 -1
View File
@@ -1,6 +1,6 @@
module myapp
go 1.24.3
go 1.25
require (
github.com/joho/godotenv v1.5.1
+6 -6
View File
@@ -56,7 +56,7 @@ type HTTPError struct {
Description string `json:"description"`
}
func newError(statusCode int, err error, format string, args ...interface{}) HTTPError {
func newError(statusCode int, err error, format string, args ...any) HTTPError {
if format == "" {
format = http.StatusText(statusCode)
}
@@ -92,7 +92,7 @@ func LogFailure(logger io.Writer, ctx iris.Context, err HTTPError) {
// Fail will send the status code, write the error's reason
// and return the HTTPError for further use, i.e logging, see `InternalServerError`.
func Fail(ctx iris.Context, statusCode int, err error, format string, args ...interface{}) HTTPError {
func Fail(ctx iris.Context, statusCode int, err error, format string, args ...any) HTTPError {
httpErr := newError(statusCode, err, format, args...)
httpErr.writeHeaders(ctx)
@@ -102,7 +102,7 @@ func Fail(ctx iris.Context, statusCode int, err error, format string, args ...in
// FailJSON will send to the client the error data as JSON.
// Useful for APIs.
func FailJSON(ctx iris.Context, statusCode int, err error, format string, args ...interface{}) HTTPError {
func FailJSON(ctx iris.Context, statusCode int, err error, format string, args ...any) HTTPError {
httpErr := newError(statusCode, err, format, args...)
httpErr.writeHeaders(ctx)
@@ -114,17 +114,17 @@ func FailJSON(ctx iris.Context, statusCode int, err error, format string, args .
// InternalServerError logs to the server's terminal
// and dispatches to the client the 500 Internal Server Error.
// Internal Server errors are critical, so we log them to the `os.Stderr`.
func InternalServerError(ctx iris.Context, err error, format string, args ...interface{}) {
func InternalServerError(ctx iris.Context, err error, format string, args ...any) {
LogFailure(os.Stderr, ctx, Fail(ctx, iris.StatusInternalServerError, err, format, args...))
}
// InternalServerErrorJSON acts exactly like `InternalServerError` but instead it sends the data as JSON.
// Useful for APIs.
func InternalServerErrorJSON(ctx iris.Context, err error, format string, args ...interface{}) {
func InternalServerErrorJSON(ctx iris.Context, err error, format string, args ...any) {
LogFailure(os.Stderr, ctx, FailJSON(ctx, iris.StatusInternalServerError, err, format, args...))
}
// UnauthorizedJSON sends JSON format of StatusUnauthorized(401) HTTPError value.
func UnauthorizedJSON(ctx iris.Context, err error, format string, args ...interface{}) HTTPError {
func UnauthorizedJSON(ctx iris.Context, err error, format string, args ...any) HTTPError {
return FailJSON(ctx, iris.StatusUnauthorized, err, format, args...)
}
@@ -45,7 +45,7 @@ func (h *CategoryHandler) GetByID(ctx iris.Context) {
type (
List struct {
Data interface{} `json:"data"`
Data any `json:"data"`
Order string `json:"order"`
Next Range `json:"next,omitempty"`
Prev Range `json:"prev,omitempty"`
@@ -136,7 +136,7 @@ func (h *CategoryHandler) Update(ctx iris.Context) {
func (h *CategoryHandler) PartialUpdate(ctx iris.Context) {
id := ctx.Params().GetInt64Default("id", 0)
var attrs map[string]interface{}
var attrs map[string]any
if err := ctx.ReadJSON(&attrs); err != nil {
return
}
+1 -1
View File
@@ -8,7 +8,7 @@ import (
const debug = true
func debugf(format string, args ...interface{}) {
func debugf(format string, args ...any) {
if !debug {
return
}
+1 -1
View File
@@ -16,7 +16,7 @@ type Error struct {
Timestamp int64 `json:"timestamp"`
}
func newError(statusCode int, method, path, format string, args ...interface{}) Error {
func newError(statusCode int, method, path, format string, args ...any) Error {
msg := format
if len(args) > 0 {
// why we check for that? If the original error message came from our database
@@ -127,7 +127,7 @@ func (h *ProductHandler) Update(ctx iris.Context) {
func (h *ProductHandler) PartialUpdate(ctx iris.Context) {
id := ctx.Params().GetInt64Default("id", 0)
var attrs map[string]interface{}
var attrs map[string]any
if err := ctx.ReadJSON(&attrs); err != nil {
return
}
+3 -3
View File
@@ -16,8 +16,8 @@ import (
// Service that cache will use to retrieve data.
type Service interface {
RecordInfo() sql.Record
GetByID(ctx context.Context, dest interface{}, id int64) error
List(ctx context.Context, dest interface{}, opts sql.ListOptions) error
GetByID(ctx context.Context, dest any, id int64) error
List(ctx context.Context, dest any, opts sql.ListOptions) error
}
// Cache is a simple structure which holds the groupcache and the database service, exposes
@@ -53,7 +53,7 @@ func (c *Cache) Get(ctx context.Context, key string, dest groupcache.Sink) error
return sql.ErrUnprocessable
}
var v interface{}
var v any
prefix := key[0:1]
key = key[1:]
+1 -1
View File
@@ -1,6 +1,6 @@
module myapp
go 1.24.3
go 1.25
require (
github.com/DATA-DOG/go-sqlmock v1.5.2
@@ -69,6 +69,6 @@ var categoryUpdateSchema = map[string]reflect.Kind{
// PartialUpdate accepts a key-value map to
// update the record based on the given "id".
func (s *CategoryService) PartialUpdate(ctx context.Context, id int64, attrs map[string]interface{}) (int, error) {
func (s *CategoryService) PartialUpdate(ctx context.Context, id int64, attrs map[string]any) (int, error) {
return s.Service.PartialUpdate(ctx, id, categoryUpdateSchema, attrs)
}
@@ -48,7 +48,7 @@ func (s *ProductService) BatchInsert(ctx context.Context, products []entity.Prod
var (
valuesLines []string
args []interface{}
args []any
)
for _, p := range products {
@@ -58,7 +58,7 @@ func (s *ProductService) BatchInsert(ctx context.Context, products []entity.Prod
}
valuesLines = append(valuesLines, "(?,?,?,?,?)")
args = append(args, []interface{}{p.CategoryID, p.Title, p.ImageURL, p.Price, p.Description}...)
args = append(args, []any{p.CategoryID, p.Title, p.ImageURL, p.Price, p.Description}...)
}
q := fmt.Sprintf("INSERT INTO %s (category_id, title, image_url, price, description) VALUES %s;",
@@ -105,6 +105,6 @@ var productUpdateSchema = map[string]reflect.Kind{
// PartialUpdate accepts a key-value map to
// update the record based on the given "id".
func (s *ProductService) PartialUpdate(ctx context.Context, id int64, attrs map[string]interface{}) (int, error) {
func (s *ProductService) PartialUpdate(ctx context.Context, id int64, attrs map[string]any) (int, error) {
return s.Service.PartialUpdate(ctx, id, productUpdateSchema, attrs)
}
+3 -3
View File
@@ -57,7 +57,7 @@ func (db *MySQL) Drop(database string) error {
}
// Select performs the SELECT query for this database (dsn database name is required).
func (db *MySQL) Select(ctx context.Context, dest interface{}, query string, args ...interface{}) error {
func (db *MySQL) Select(ctx context.Context, dest any, query string, args ...any) error {
rows, err := db.Conn.QueryContext(ctx, query, args...)
if err != nil {
return err
@@ -99,7 +99,7 @@ func (db *MySQL) Select(ctx context.Context, dest interface{}, query string, arg
}
// Get same as `Select` but it moves the cursor to the first result.
func (db *MySQL) Get(ctx context.Context, dest interface{}, query string, args ...interface{}) error {
func (db *MySQL) Get(ctx context.Context, dest any, query string, args ...any) error {
rows, err := db.Conn.QueryContext(ctx, query, args...)
if err != nil {
return err
@@ -118,6 +118,6 @@ func (db *MySQL) Get(ctx context.Context, dest interface{}, query string, args .
// Exec executes a query. It does not return any rows.
// Use the first output parameter to count the affected rows on UPDATE, INSERT, or DELETE.
func (db *MySQL) Exec(ctx context.Context, query string, args ...interface{}) (sql.Result, error) {
func (db *MySQL) Exec(ctx context.Context, query string, args ...any) (sql.Result, error) {
return db.Conn.ExecContext(ctx, query, args...)
}
+7 -7
View File
@@ -38,7 +38,7 @@ func (s *Service) RecordInfo() Record {
var ErrNoRows = sql.ErrNoRows
// GetByID binds a single record from the databases to the "dest".
func (s *Service) GetByID(ctx context.Context, dest interface{}, id int64) error {
func (s *Service) GetByID(ctx context.Context, dest any, id int64) error {
q := fmt.Sprintf("SELECT * FROM %s WHERE %s = ? LIMIT 1", s.rec.TableName(), s.rec.PrimaryKey())
err := s.db.Get(ctx, dest, q, id)
return err
@@ -70,14 +70,14 @@ type ListOptions struct {
OrderByColumn string
Order string // "ASC" or "DESC" (could be a bool type instead).
WhereColumn string
WhereValue interface{}
WhereValue any
}
// Where accepts a column name and column value to set
// on the WHERE clause of the result query.
// It returns a new `ListOptions` value.
// Note that this is a basic implementation which just takes care our current needs.
func (opt ListOptions) Where(colName string, colValue interface{}) ListOptions {
func (opt ListOptions) Where(colName string, colValue any) ListOptions {
opt.WhereColumn = colName
opt.WhereValue = colValue
return opt
@@ -85,7 +85,7 @@ func (opt ListOptions) Where(colName string, colValue interface{}) ListOptions {
// BuildQuery returns the query and the arguments that
// should be form a SELECT command.
func (opt ListOptions) BuildQuery() (q string, args []interface{}) {
func (opt ListOptions) BuildQuery() (q string, args []any) {
q = fmt.Sprintf("SELECT * FROM %s", opt.Table)
if opt.WhereColumn != "" && opt.WhereValue != nil {
@@ -122,7 +122,7 @@ func ParseListOptions(q url.Values) ListOptions {
// List binds one or more records from the database to the "dest".
// If the record supports ordering then it will sort by the `Sorted.OrderBy` column name(s).
// Use the "order" input parameter to set a descending order ("DESC").
func (s *Service) List(ctx context.Context, dest interface{}, opts ListOptions) error {
func (s *Service) List(ctx context.Context, dest any, opts ListOptions) error {
// Set table and order by column from record info for `List` by options
// so it can be more flexible to perform read-only calls of other table's too.
if opts.Table == "" {
@@ -160,14 +160,14 @@ var ErrUnprocessable = errors.New("invalid entity")
// PartialUpdate accepts a columns schema and a key-value map to
// update the record based on the given "id".
// Note: Trivial string, int and boolean type validations are performed here.
func (s *Service) PartialUpdate(ctx context.Context, id int64, schema map[string]reflect.Kind, attrs map[string]interface{}) (int, error) {
func (s *Service) PartialUpdate(ctx context.Context, id int64, schema map[string]reflect.Kind, attrs map[string]any) (int, error) {
if len(schema) == 0 || len(attrs) == 0 {
return 0, nil
}
var (
keyLines []string
values []interface{}
values []any
)
for key, kind := range schema {
+3 -3
View File
@@ -7,9 +7,9 @@ import (
// Database is an interface which a database(sql) should implement.
type Database interface {
Get(ctx context.Context, dest interface{}, q string, args ...interface{}) error
Select(ctx context.Context, dest interface{}, q string, args ...interface{}) error
Exec(ctx context.Context, q string, args ...interface{}) (sql.Result, error)
Get(ctx context.Context, dest any, q string, args ...any) error
Select(ctx context.Context, dest any, q string, args ...any) error
Exec(ctx context.Context, q string, args ...any) (sql.Result, error)
}
// Record should represent a database record.
+1 -1
View File
@@ -150,7 +150,7 @@ func main() {
var body patchParam
ctx.ReadJSON(&body)
app.Logger().Println(body)
if err := tx.Model(&user).Updates(map[string]interface{}{"username": body.Data.UserName, "password": body.Data.Password}).Error; err != nil {
if err := tx.Model(&user).Updates(map[string]any{"username": body.Data.UserName, "password": body.Data.Password}).Error; err != nil {
app.Logger().Fatalf("update record failed")
tx.Rollback()
ctx.JSON(iris.Map{
+1 -1
View File
@@ -1,6 +1,6 @@
module myapp
go 1.24.3
go 1.25
require (
github.com/kataras/golog v0.1.13
@@ -12,7 +12,7 @@ import (
type personTableType struct {
s parse.StructInfo
z []interface{}
z []any
}
// Schema returns a schema name in SQL database ("").
@@ -63,9 +63,9 @@ func (s Person) String() string {
}
// Values returns a slice of struct or record field values.
// Returned interface{} values are never untyped nils.
func (s *Person) Values() []interface{} {
return []interface{}{
// Returned any values are never untyped nils.
func (s *Person) Values() []any {
return []any{
s.ID,
s.Name,
s.Email,
@@ -75,9 +75,9 @@ func (s *Person) Values() []interface{} {
}
// Pointers returns a slice of pointers to struct or record fields.
// Returned interface{} values are never untyped nils.
func (s *Person) Pointers() []interface{} {
return []interface{}{
// Returned any values are never untyped nils.
func (s *Person) Pointers() []any {
return []any{
&s.ID,
&s.Name,
&s.Email,
@@ -97,14 +97,14 @@ func (s *Person) Table() reform.Table {
}
// PKValue returns a value of primary key for that record.
// Returned interface{} value is never untyped nil.
func (s *Person) PKValue() interface{} {
// Returned any value is never untyped nil.
func (s *Person) PKValue() any {
return s.ID
}
// PKPointer returns a pointer to primary key field for that record.
// Returned interface{} value is never untyped nil.
func (s *Person) PKPointer() interface{} {
// Returned any value is never untyped nil.
func (s *Person) PKPointer() any {
return &s.ID
}
@@ -114,7 +114,7 @@ func (s *Person) HasPK() bool {
}
// SetPK sets record primary key.
func (s *Person) SetPK(pk interface{}) {
func (s *Person) SetPK(pk any) {
if i64, ok := pk.(int64); ok {
s.ID = int32(i64)
} else {
+1 -1
View File
@@ -51,7 +51,7 @@ func main() {
app.Get("/insert", func(ctx iris.Context) {
res, err := db.NamedExec(`INSERT INTO person (first_name,last_name,email) VALUES (:first,:last,:email)`,
map[string]interface{}{
map[string]any{
"first": "John",
"last": "Doe",
"email": "johndoe@example.com",
+2 -2
View File
@@ -28,8 +28,8 @@ func configureAPI(api *iris.APIContainer) {
/* Here is how you can inject a return value from a handler,
in this case the "testOutput":
api.UseResultHandler(func(next iris.ResultHandler) iris.ResultHandler {
return func(ctx iris.Context, v interface{}) error {
return next(ctx, map[string]interface{}{"injected": true})
return func(ctx iris.Context, v any) error {
return next(ctx, map[string]any{"injected": true})
}
})
*/
@@ -1,6 +1,6 @@
module github.com/kataras/iris/_examples/dependency-injection/jwt/contrib
go 1.24.3
go 1.25
require (
github.com/iris-contrib/middleware/jwt v0.0.0-20250207234507-372f6828ef8c
@@ -19,7 +19,7 @@ func register(api *iris.APIContainer) {
j := jwt.New(jwt.Config{
// Extract by "token" url parameter.
Extractor: jwt.FromFirst(jwt.FromParameter("token"), jwt.FromAuthHeader),
ValidationKeyGetter: func(token *jwt.Token) (interface{}, error) {
ValidationKeyGetter: func(token *jwt.Token) (any, error) {
return secret, nil
},
SigningMethod: jwt.SigningMethodHS256,
@@ -10,7 +10,7 @@ import (
var helloView = hero.View{
Name: "hello/index.html",
Data: map[string]interface{}{
Data: map[string]any{
"Title": "Hello Page",
"MyMessage": "Welcome to my awesome website",
},
@@ -47,7 +47,7 @@ func UpdateMovieByID(ctx iris.Context, service services.MovieService, id uint64)
// DeleteMovieByID deletes a movie.
// Demo:
// curl -i -X DELETE -u admin:password http://localhost:8080/movies/1
func DeleteMovieByID(service services.MovieService, id uint64) interface{} {
func DeleteMovieByID(service services.MovieService, id uint64) any {
wasDel := service.DeleteByID(id)
if wasDel {
// return the deleted movie's ID
@@ -124,7 +124,7 @@ func (h httpError) Error() string {
return fmt.Sprintf("Status Code: %d\nReason: %s", h.Code, h.Reason)
}
func fail(ctx iris.Context, statusCode int, format string, a ...interface{}) {
func fail(ctx iris.Context, statusCode int, format string, a ...any) {
err := httpError{
Code: statusCode,
Reason: fmt.Sprintf(format, a...),
@@ -141,7 +141,7 @@ func fail(ctx iris.Context, statusCode int, format string, a ...interface{}) {
// JSON helper to give end-user the ability to put indention chars or filtering the response, you can do that, optionally.
// If you'd like to see that function inside the Iris' Context itself raise a [Feature Request] issue and link this example.
func sendJSON(ctx iris.Context, resp interface{}) (err error) {
func sendJSON(ctx iris.Context, resp any) (err error) {
indent := ctx.URLParamDefault("indent", " ")
// i.e [?Name == 'John Doe'].Age # to output the [age] of a user which his name is "John Doe".
if query := ctx.URLParam("query"); query != "" && query != "[]" {
+1 -1
View File
@@ -1,6 +1,6 @@
module github.com/kataras/iris/_examples/desktop/webview
go 1.24.3
go 1.25
require (
github.com/kataras/iris/v12 v12.2.11-0.20250430051100-af9c8213980c
@@ -76,7 +76,7 @@ func (fi bindataFileInfo) IsDir() bool {
}
// Sys return file is sys mode
func (fi bindataFileInfo) Sys() interface{} {
func (fi bindataFileInfo) Sys() any {
return nil
}
@@ -76,7 +76,7 @@ func (fi bindataFileInfo) IsDir() bool {
}
// Sys return file is sys mode
func (fi bindataFileInfo) Sys() interface{} {
func (fi bindataFileInfo) Sys() any {
return nil
}
@@ -84,7 +84,7 @@ func (fi bindataFileInfo) IsDir() bool {
}
// Sys return file is sys mode
func (fi bindataFileInfo) Sys() interface{} {
func (fi bindataFileInfo) Sys() any {
return nil
}
@@ -84,7 +84,7 @@ func (fi bindataFileInfo) IsDir() bool {
}
// Sys return file is sys mode
func (fi bindataFileInfo) Sys() interface{} {
func (fi bindataFileInfo) Sys() any {
return nil
}
@@ -76,7 +76,7 @@ func (fi bindataFileInfo) IsDir() bool {
}
// Sys return file is sys mode
func (fi bindataFileInfo) Sys() interface{} {
func (fi bindataFileInfo) Sys() any {
return nil
}
@@ -78,7 +78,7 @@ func (fi bindataFileInfo) IsDir() bool {
}
// Sys return file is sys mode
func (fi bindataFileInfo) Sys() interface{} {
func (fi bindataFileInfo) Sys() any {
return nil
}
+1 -1
View File
@@ -1,6 +1,6 @@
module github.com/iris-contrib/outerbanks-api
go 1.24.3
go 1.25
require (
github.com/99designs/gqlgen v0.17.73
@@ -79,7 +79,7 @@ func (e *executableSchema) Schema() *ast.Schema {
return parsedSchema
}
func (e *executableSchema) Complexity(typeName, field string, childComplexity int, rawArgs map[string]interface{}) (int, bool) {
func (e *executableSchema) Complexity(typeName, field string, childComplexity int, rawArgs map[string]any) (int, bool) {
ec := executionContext{nil, e}
_ = ec
switch typeName + "." + field {
@@ -236,9 +236,9 @@ var parsedSchema = gqlparser.MustLoadSchema(sources...)
// region ***************************** args.gotpl *****************************
func (ec *executionContext) field_Mutation_upsertCharacter_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
func (ec *executionContext) field_Mutation_upsertCharacter_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) {
var err error
args := map[string]interface{}{}
args := map[string]any{}
var arg0 model.CharacterInput
if tmp, ok := rawArgs["input"]; ok {
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("input"))
@@ -251,9 +251,9 @@ func (ec *executionContext) field_Mutation_upsertCharacter_args(ctx context.Cont
return args, nil
}
func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) {
var err error
args := map[string]interface{}{}
args := map[string]any{}
var arg0 string
if tmp, ok := rawArgs["name"]; ok {
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name"))
@@ -266,9 +266,9 @@ func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs
return args, nil
}
func (ec *executionContext) field_Query_character_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
func (ec *executionContext) field_Query_character_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) {
var err error
args := map[string]interface{}{}
args := map[string]any{}
var arg0 string
if tmp, ok := rawArgs["id"]; ok {
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id"))
@@ -281,9 +281,9 @@ func (ec *executionContext) field_Query_character_args(ctx context.Context, rawA
return args, nil
}
func (ec *executionContext) field_Query_characters_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
func (ec *executionContext) field_Query_characters_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) {
var err error
args := map[string]interface{}{}
args := map[string]any{}
var arg0 model.CliqueType
if tmp, ok := rawArgs["cliqueType"]; ok {
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cliqueType"))
@@ -296,9 +296,9 @@ func (ec *executionContext) field_Query_characters_args(ctx context.Context, raw
return args, nil
}
func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) {
var err error
args := map[string]interface{}{}
args := map[string]any{}
var arg0 bool
if tmp, ok := rawArgs["includeDeprecated"]; ok {
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated"))
@@ -311,9 +311,9 @@ func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, ra
return args, nil
}
func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) {
var err error
args := map[string]interface{}{}
args := map[string]any{}
var arg0 bool
if tmp, ok := rawArgs["includeDeprecated"]; ok {
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated"))
@@ -346,7 +346,7 @@ func (ec *executionContext) _Character_id(ctx context.Context, field graphql.Col
ret = graphql.Null
}
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
ctx = rctx // use context from middleware stack in children
return obj.ID, nil
})
@@ -390,7 +390,7 @@ func (ec *executionContext) _Character_name(ctx context.Context, field graphql.C
ret = graphql.Null
}
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
ctx = rctx // use context from middleware stack in children
return obj.Name, nil
})
@@ -434,7 +434,7 @@ func (ec *executionContext) _Character_isHero(ctx context.Context, field graphql
ret = graphql.Null
}
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
ctx = rctx // use context from middleware stack in children
return obj.IsHero, nil
})
@@ -478,7 +478,7 @@ func (ec *executionContext) _Character_cliqueType(ctx context.Context, field gra
ret = graphql.Null
}
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
ctx = rctx // use context from middleware stack in children
return obj.CliqueType, nil
})
@@ -522,7 +522,7 @@ func (ec *executionContext) _Mutation_upsertCharacter(ctx context.Context, field
ret = graphql.Null
}
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
ctx = rctx // use context from middleware stack in children
return ec.resolvers.Mutation().UpsertCharacter(rctx, fc.Args["input"].(model.CharacterInput))
})
@@ -586,7 +586,7 @@ func (ec *executionContext) _Query_character(ctx context.Context, field graphql.
ret = graphql.Null
}
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
ctx = rctx // use context from middleware stack in children
return ec.resolvers.Query().Character(rctx, fc.Args["id"].(string))
})
@@ -647,7 +647,7 @@ func (ec *executionContext) _Query_characters(ctx context.Context, field graphql
ret = graphql.Null
}
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
ctx = rctx // use context from middleware stack in children
return ec.resolvers.Query().Characters(rctx, fc.Args["cliqueType"].(model.CliqueType))
})
@@ -708,7 +708,7 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col
ret = graphql.Null
}
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
ctx = rctx // use context from middleware stack in children
return ec.introspectType(fc.Args["name"].(string))
})
@@ -781,7 +781,7 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C
ret = graphql.Null
}
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
ctx = rctx // use context from middleware stack in children
return ec.introspectSchema()
})
@@ -835,7 +835,7 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql
ret = graphql.Null
}
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
ctx = rctx // use context from middleware stack in children
return obj.Name, nil
})
@@ -879,7 +879,7 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field
ret = graphql.Null
}
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
ctx = rctx // use context from middleware stack in children
return obj.Description(), nil
})
@@ -920,7 +920,7 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr
ret = graphql.Null
}
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
ctx = rctx // use context from middleware stack in children
return obj.Locations, nil
})
@@ -964,7 +964,7 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql
ret = graphql.Null
}
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
ctx = rctx // use context from middleware stack in children
return obj.Args, nil
})
@@ -1018,7 +1018,7 @@ func (ec *executionContext) ___Directive_isRepeatable(ctx context.Context, field
ret = graphql.Null
}
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
ctx = rctx // use context from middleware stack in children
return obj.IsRepeatable, nil
})
@@ -1062,7 +1062,7 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql
ret = graphql.Null
}
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
ctx = rctx // use context from middleware stack in children
return obj.Name, nil
})
@@ -1106,7 +1106,7 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field
ret = graphql.Null
}
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
ctx = rctx // use context from middleware stack in children
return obj.Description(), nil
})
@@ -1147,7 +1147,7 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field
ret = graphql.Null
}
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
ctx = rctx // use context from middleware stack in children
return obj.IsDeprecated(), nil
})
@@ -1191,7 +1191,7 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context,
ret = graphql.Null
}
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
ctx = rctx // use context from middleware stack in children
return obj.DeprecationReason(), nil
})
@@ -1232,7 +1232,7 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col
ret = graphql.Null
}
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
ctx = rctx // use context from middleware stack in children
return obj.Name, nil
})
@@ -1276,7 +1276,7 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap
ret = graphql.Null
}
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
ctx = rctx // use context from middleware stack in children
return obj.Description(), nil
})
@@ -1317,7 +1317,7 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col
ret = graphql.Null
}
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
ctx = rctx // use context from middleware stack in children
return obj.Args, nil
})
@@ -1371,7 +1371,7 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col
ret = graphql.Null
}
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
ctx = rctx // use context from middleware stack in children
return obj.Type, nil
})
@@ -1437,7 +1437,7 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra
ret = graphql.Null
}
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
ctx = rctx // use context from middleware stack in children
return obj.IsDeprecated(), nil
})
@@ -1481,7 +1481,7 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel
ret = graphql.Null
}
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
ctx = rctx // use context from middleware stack in children
return obj.DeprecationReason(), nil
})
@@ -1522,7 +1522,7 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq
ret = graphql.Null
}
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
ctx = rctx // use context from middleware stack in children
return obj.Name, nil
})
@@ -1566,7 +1566,7 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field
ret = graphql.Null
}
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
ctx = rctx // use context from middleware stack in children
return obj.Description(), nil
})
@@ -1607,7 +1607,7 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq
ret = graphql.Null
}
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
ctx = rctx // use context from middleware stack in children
return obj.Type, nil
})
@@ -1673,7 +1673,7 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel
ret = graphql.Null
}
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
ctx = rctx // use context from middleware stack in children
return obj.DefaultValue, nil
})
@@ -1714,7 +1714,7 @@ func (ec *executionContext) ___Schema_description(ctx context.Context, field gra
ret = graphql.Null
}
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
ctx = rctx // use context from middleware stack in children
return obj.Description(), nil
})
@@ -1755,7 +1755,7 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C
ret = graphql.Null
}
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
ctx = rctx // use context from middleware stack in children
return obj.Types(), nil
})
@@ -1821,7 +1821,7 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph
ret = graphql.Null
}
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
ctx = rctx // use context from middleware stack in children
return obj.QueryType(), nil
})
@@ -1887,7 +1887,7 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr
ret = graphql.Null
}
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
ctx = rctx // use context from middleware stack in children
return obj.MutationType(), nil
})
@@ -1950,7 +1950,7 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel
ret = graphql.Null
}
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
ctx = rctx // use context from middleware stack in children
return obj.SubscriptionType(), nil
})
@@ -2013,7 +2013,7 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap
ret = graphql.Null
}
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
ctx = rctx // use context from middleware stack in children
return obj.Directives(), nil
})
@@ -2069,7 +2069,7 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll
ret = graphql.Null
}
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
ctx = rctx // use context from middleware stack in children
return obj.Kind(), nil
})
@@ -2113,7 +2113,7 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll
ret = graphql.Null
}
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
ctx = rctx // use context from middleware stack in children
return obj.Name(), nil
})
@@ -2154,7 +2154,7 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph
ret = graphql.Null
}
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
ctx = rctx // use context from middleware stack in children
return obj.Description(), nil
})
@@ -2195,7 +2195,7 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co
ret = graphql.Null
}
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
ctx = rctx // use context from middleware stack in children
return obj.Fields(fc.Args["includeDeprecated"].(bool)), nil
})
@@ -2261,7 +2261,7 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq
ret = graphql.Null
}
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
ctx = rctx // use context from middleware stack in children
return obj.Interfaces(), nil
})
@@ -2324,7 +2324,7 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra
ret = graphql.Null
}
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
ctx = rctx // use context from middleware stack in children
return obj.PossibleTypes(), nil
})
@@ -2387,7 +2387,7 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq
ret = graphql.Null
}
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
ctx = rctx // use context from middleware stack in children
return obj.EnumValues(fc.Args["includeDeprecated"].(bool)), nil
})
@@ -2449,7 +2449,7 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph
ret = graphql.Null
}
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
ctx = rctx // use context from middleware stack in children
return obj.InputFields(), nil
})
@@ -2500,7 +2500,7 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co
ret = graphql.Null
}
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
ctx = rctx // use context from middleware stack in children
return obj.OfType(), nil
})
@@ -2563,7 +2563,7 @@ func (ec *executionContext) ___Type_specifiedByURL(ctx context.Context, field gr
ret = graphql.Null
}
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
ctx = rctx // use context from middleware stack in children
return obj.SpecifiedByURL(), nil
})
@@ -2596,10 +2596,10 @@ func (ec *executionContext) fieldContext___Type_specifiedByURL(ctx context.Conte
// region **************************** input.gotpl *****************************
func (ec *executionContext) unmarshalInputCharacterInput(ctx context.Context, obj interface{}) (model.CharacterInput, error) {
func (ec *executionContext) unmarshalInputCharacterInput(ctx context.Context, obj any) (model.CharacterInput, error) {
var it model.CharacterInput
asMap := map[string]interface{}{}
for k, v := range obj.(map[string]interface{}) {
asMap := map[string]any{}
for k, v := range obj.(map[string]any) {
asMap[k] = v
}
@@ -3133,7 +3133,7 @@ func (ec *executionContext) ___Type(ctx context.Context, sel ast.SelectionSet, o
// region ***************************** type.gotpl *****************************
func (ec *executionContext) unmarshalNBoolean2bool(ctx context.Context, v interface{}) (bool, error) {
func (ec *executionContext) unmarshalNBoolean2bool(ctx context.Context, v any) (bool, error) {
res, err := graphql.UnmarshalBoolean(v)
return res, graphql.ErrorOnPath(ctx, err)
}
@@ -3162,12 +3162,12 @@ func (ec *executionContext) marshalNCharacter2ᚖgithubᚗcomᚋirisᚑcontrib
return ec._Character(ctx, sel, v)
}
func (ec *executionContext) unmarshalNCharacterInput2githubᚗcomᚋirisᚑcontribᚋouterbanksᚑapiᚋgraphᚋgraphᚋmodelᚐCharacterInput(ctx context.Context, v interface{}) (model.CharacterInput, error) {
func (ec *executionContext) unmarshalNCharacterInput2githubᚗcomᚋirisᚑcontribᚋouterbanksᚑapiᚋgraphᚋgraphᚋmodelᚐCharacterInput(ctx context.Context, v any) (model.CharacterInput, error) {
res, err := ec.unmarshalInputCharacterInput(ctx, v)
return res, graphql.ErrorOnPath(ctx, err)
}
func (ec *executionContext) unmarshalNCliqueType2githubᚗcomᚋirisᚑcontribᚋouterbanksᚑapiᚋgraphᚋgraphᚋmodelᚐCliqueType(ctx context.Context, v interface{}) (model.CliqueType, error) {
func (ec *executionContext) unmarshalNCliqueType2githubᚗcomᚋirisᚑcontribᚋouterbanksᚑapiᚋgraphᚋgraphᚋmodelᚐCliqueType(ctx context.Context, v any) (model.CliqueType, error) {
var res model.CliqueType
err := res.UnmarshalGQL(v)
return res, graphql.ErrorOnPath(ctx, err)
@@ -3177,7 +3177,7 @@ func (ec *executionContext) marshalNCliqueType2githubᚗcomᚋirisᚑcontribᚋo
return v
}
func (ec *executionContext) unmarshalNID2string(ctx context.Context, v interface{}) (string, error) {
func (ec *executionContext) unmarshalNID2string(ctx context.Context, v any) (string, error) {
res, err := graphql.UnmarshalID(v)
return res, graphql.ErrorOnPath(ctx, err)
}
@@ -3192,7 +3192,7 @@ func (ec *executionContext) marshalNID2string(ctx context.Context, sel ast.Selec
return res
}
func (ec *executionContext) unmarshalNString2string(ctx context.Context, v interface{}) (string, error) {
func (ec *executionContext) unmarshalNString2string(ctx context.Context, v any) (string, error) {
res, err := graphql.UnmarshalString(v)
return res, graphql.ErrorOnPath(ctx, err)
}
@@ -3255,7 +3255,7 @@ func (ec *executionContext) marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgq
return ret
}
func (ec *executionContext) unmarshalN__DirectiveLocation2string(ctx context.Context, v interface{}) (string, error) {
func (ec *executionContext) unmarshalN__DirectiveLocation2string(ctx context.Context, v any) (string, error) {
res, err := graphql.UnmarshalString(v)
return res, graphql.ErrorOnPath(ctx, err)
}
@@ -3270,8 +3270,8 @@ func (ec *executionContext) marshalN__DirectiveLocation2string(ctx context.Conte
return res
}
func (ec *executionContext) unmarshalN__DirectiveLocation2ᚕstringᚄ(ctx context.Context, v interface{}) ([]string, error) {
var vSlice []interface{}
func (ec *executionContext) unmarshalN__DirectiveLocation2ᚕstringᚄ(ctx context.Context, v any) ([]string, error) {
var vSlice []any
if v != nil {
vSlice = graphql.CoerceList(v)
}
@@ -3445,7 +3445,7 @@ func (ec *executionContext) marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgen
return ec.___Type(ctx, sel, v)
}
func (ec *executionContext) unmarshalN__TypeKind2string(ctx context.Context, v interface{}) (string, error) {
func (ec *executionContext) unmarshalN__TypeKind2string(ctx context.Context, v any) (string, error) {
res, err := graphql.UnmarshalString(v)
return res, graphql.ErrorOnPath(ctx, err)
}
@@ -3460,7 +3460,7 @@ func (ec *executionContext) marshalN__TypeKind2string(ctx context.Context, sel a
return res
}
func (ec *executionContext) unmarshalOBoolean2bool(ctx context.Context, v interface{}) (bool, error) {
func (ec *executionContext) unmarshalOBoolean2bool(ctx context.Context, v any) (bool, error) {
res, err := graphql.UnmarshalBoolean(v)
return res, graphql.ErrorOnPath(ctx, err)
}
@@ -3470,7 +3470,7 @@ func (ec *executionContext) marshalOBoolean2bool(ctx context.Context, sel ast.Se
return res
}
func (ec *executionContext) unmarshalOBoolean2ᚖbool(ctx context.Context, v interface{}) (*bool, error) {
func (ec *executionContext) unmarshalOBoolean2ᚖbool(ctx context.Context, v any) (*bool, error) {
if v == nil {
return nil, nil
}
@@ -3540,7 +3540,7 @@ func (ec *executionContext) marshalOCharacter2ᚖgithubᚗcomᚋirisᚑcontrib
return ec._Character(ctx, sel, v)
}
func (ec *executionContext) unmarshalOString2ᚖstring(ctx context.Context, v interface{}) (*string, error) {
func (ec *executionContext) unmarshalOString2ᚖstring(ctx context.Context, v any) (*string, error) {
if v == nil {
return nil, nil
}
@@ -48,7 +48,7 @@ func (e CliqueType) String() string {
return string(e)
}
func (e *CliqueType) UnmarshalGQL(v interface{}) error {
func (e *CliqueType) UnmarshalGQL(v any) error {
str, ok := v.(string)
if !ok {
return fmt.Errorf("enums must be strings")
+1 -1
View File
@@ -1,6 +1,6 @@
module github.com/kataras/iris/_examples/http-server/h2c
go 1.24.3
go 1.25
require (
github.com/kataras/iris/v12 v12.2.11-0.20250430051100-af9c8213980c
+1 -1
View File
@@ -1,6 +1,6 @@
module github.com/kataras/iris/_examples/http-server/http3-quic
go 1.24.3
go 1.25
require (
github.com/kataras/iris/v12 v12.2.11-0.20250430051100-af9c8213980c
+2 -2
View File
@@ -35,7 +35,7 @@ func newApp() *iris.Application {
// This is why this one accepts both input and matched languages,
// so the caller can be more expressful knowing those.
// Defaults to nil.
app.I18n.DefaultMessageFunc = func(langInput, langMatched, key string, args ...interface{}) string {
app.I18n.DefaultMessageFunc = func(langInput, langMatched, key string, args ...any) string {
msg := fmt.Sprintf("user language input: %s: matched as: %s: not found key: %s: args: %v", langInput, langMatched, key, args)
app.Logger().Warn(msg)
return msg
@@ -83,7 +83,7 @@ func newApp() *iris.Application {
app.Get("/templates", func(ctx iris.Context) {
if err := ctx.View("index.html", iris.Map{
"tr": ctx.Tr, // word, arguments... {call .tr "hi" "iris"}}
"trUnsafe": func(message string, args ...interface{}) template.HTML {
"trUnsafe": func(message string, args ...any) template.HTML {
return template.HTML(ctx.Tr(message, args...))
},
}); err != nil {
+1 -1
View File
@@ -169,7 +169,7 @@ func main() {
app.Listen(":8080")
}
func tr(ctx iris.Context, key string, args ...interface{}) {
func tr(ctx iris.Context, key string, args ...any) {
translation := ctx.Tr(key, args...)
ctx.Writef("<tr><td>%s</td><td>%s</td><td>%v</td></tr>\n", key, translation, args)
}
+1 -1
View File
@@ -125,7 +125,7 @@ LocalVarsHouseCount.Text=She has 4 houses
}
}
func tr(ctx iris.Context, key string, args ...interface{}) {
func tr(ctx iris.Context, key string, args ...any) {
translation := ctx.Tr(key, args...)
ctx.Writef("%s=%s\n", key, translation)
}
+1 -1
View File
@@ -1,6 +1,6 @@
module myapp
go 1.24.3
go 1.25
require (
github.com/IBM/sarama v1.45.2
+1 -1
View File
@@ -144,7 +144,7 @@ func (h httpError) Error() string {
return fmt.Sprintf("Status Code: %d\nReason: %s", h.Code, h.Reason)
}
func fail(ctx iris.Context, statusCode int, format string, a ...interface{}) {
func fail(ctx iris.Context, statusCode int, format string, a ...any) {
reason := "unspecified"
if format != "" {
reason = fmt.Sprintf(format, a...)
@@ -78,7 +78,7 @@ func profileHandler(ctx iris.Context) {
}
func readBodyHandler(ctx iris.Context) {
var request interface{}
var request any
if err := ctx.ReadBody(&request); err != nil {
ctx.StopWithPlainError(iris.StatusBadRequest, err)
return
@@ -64,7 +64,7 @@ func newCustomFormatter(delim byte, blank string) *customFormatter {
func (f *customFormatter) SetOutput(dest io.Writer) {
f.w = dest
f.bufPool = &sync.Pool{
New: func() interface{} {
New: func() any {
return new(bytes.Buffer)
},
}
@@ -17,7 +17,7 @@ func main() {
}
func readWriteHandler(ctx iris.Context) {
var req interface{}
var req any
ctx.ReadBody(&req)
ctx.JSON(iris.Map{
@@ -1,6 +1,6 @@
module github.com/kataras/iris/_examples/logging/accesslog-slack
go 1.24.3
go 1.25
require (
github.com/kataras/iris/v12 v12.2.11-0.20250430051100-af9c8213980c
@@ -45,7 +45,7 @@ func makeAccessLog() *accesslog.AccessLog {
if sess := sessions.Get(ctx); sess != nil {
fields.Set("session_id", sess.ID())
sess.Visit(func(k string, v interface{}) {
sess.Visit(func(k string, v any) {
fields.Set(k, v)
})
}
@@ -130,7 +130,7 @@ func main() {
}
func readBodyHandler(ctx iris.Context) {
var request interface{}
var request any
if err := ctx.ReadBody(&request); err != nil {
ctx.StopWithPlainError(iris.StatusBadRequest, err)
return
+1 -1
View File
@@ -1,6 +1,6 @@
module github.com/kataras/iris/examples/logging/rollbar
go 1.24.3
go 1.25
require (
github.com/kataras/iris/v12 v12.2.11-0.20250430051100-af9c8213980c
+1 -1
View File
@@ -1,6 +1,6 @@
module github.com/kataras/iris/_examples/statsviz
go 1.24.3
go 1.25
require (
github.com/arl/statsviz v0.6.0
+2 -2
View File
@@ -12,7 +12,7 @@ func main() {
// Hijack each output value of a method (can be used per-party too).
app.ConfigureContainer().
UseResultHandler(func(next iris.ResultHandler) iris.ResultHandler {
return func(ctx iris.Context, v interface{}) error {
return func(ctx iris.Context, v any) error {
switch val := v.(type) {
case errorResponse:
return next(ctx, errorView(val))
@@ -48,7 +48,7 @@ type user struct {
ID uint64 `json:"id"`
}
func (c *controller) GetBy(userid uint64) interface{} {
func (c *controller) GetBy(userid uint64) any {
if userid != 1 {
return errorResponse{
Code: iris.StatusNotFound,
@@ -22,11 +22,11 @@ type controller struct{}
// Generic response type for JSON results.
type response struct {
ID uint64 `json:"id,omitempty"`
Data interface{} `json:"data,omitempty"` // {data: result } on fetch actions.
Code int `json:"code,omitempty"`
Message string `json:"message,omitempty"`
Timestamp int64 `json:"timestamp,omitempty"`
ID uint64 `json:"id,omitempty"`
Data any `json:"data,omitempty"` // {data: result } on fetch actions.
Code int `json:"code,omitempty"`
Message string `json:"message,omitempty"`
Timestamp int64 `json:"timestamp,omitempty"`
}
func (r *response) Preflight(ctx iris.Context) error {
@@ -1,6 +1,6 @@
module grpcexample
go 1.24.3
go 1.25
require (
github.com/golang/protobuf v1.5.4
@@ -170,7 +170,7 @@ func file_helloworld_proto_rawDescGZIP() []byte {
}
var file_helloworld_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_helloworld_proto_goTypes = []interface{}{
var file_helloworld_proto_goTypes = []any{
(*HelloRequest)(nil), // 0: helloworld.HelloRequest
(*HelloReply)(nil), // 1: helloworld.HelloReply
}
@@ -196,7 +196,7 @@ func file_helloworld_proto_init() {
return
}
if !protoimpl.UnsafeEnabled {
file_helloworld_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
file_helloworld_proto_msgTypes[0].Exporter = func(v any, i int) any {
switch v := v.(*HelloRequest); i {
case 0:
return &v.state
@@ -208,7 +208,7 @@ func file_helloworld_proto_init() {
return nil
}
}
file_helloworld_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
file_helloworld_proto_msgTypes[1].Exporter = func(v any, i int) any {
switch v := v.(*HelloReply); i {
case 0:
return &v.state
@@ -67,7 +67,7 @@ func RegisterGreeterServer(s grpc.ServiceRegistrar, srv GreeterServer) {
s.RegisterService(&_Greeter_serviceDesc, srv)
}
func _Greeter_SayHello_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
func _Greeter_SayHello_Handler(srv any, ctx context.Context, dec func(any) error, interceptor grpc.UnaryServerInterceptor) (any, error) {
in := new(HelloRequest)
if err := dec(in); err != nil {
return nil, err
@@ -79,7 +79,7 @@ func _Greeter_SayHello_Handler(srv interface{}, ctx context.Context, dec func(in
Server: srv,
FullMethod: "/helloworld.Greeter/SayHello",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
handler := func(ctx context.Context, req any) (any, error) {
return srv.(GreeterServer).SayHello(ctx, req.(*HelloRequest))
}
return interceptor(ctx, in, info, handler)
@@ -176,7 +176,7 @@ func RegisterGreeterServerSideSStreamServer(s grpc.ServiceRegistrar, srv Greeter
s.RegisterService(&_GreeterServerSideSStream_serviceDesc, srv)
}
func _GreeterServerSideSStream_SayHello_Handler(srv interface{}, stream grpc.ServerStream) error {
func _GreeterServerSideSStream_SayHello_Handler(srv any, stream grpc.ServerStream) error {
m := new(HelloRequest)
if err := stream.RecvMsg(m); err != nil {
return err
@@ -291,7 +291,7 @@ func RegisterGreeterClientSideStreamServer(s grpc.ServiceRegistrar, srv GreeterC
s.RegisterService(&_GreeterClientSideStream_serviceDesc, srv)
}
func _GreeterClientSideStream_SayHello_Handler(srv interface{}, stream grpc.ServerStream) error {
func _GreeterClientSideStream_SayHello_Handler(srv any, stream grpc.ServerStream) error {
return srv.(GreeterClientSideStreamServer).SayHello(&greeterClientSideStreamSayHelloServer{stream})
}
@@ -408,7 +408,7 @@ func RegisterGreeterBidirectionalStreamServer(s grpc.ServiceRegistrar, srv Greet
s.RegisterService(&_GreeterBidirectionalStream_serviceDesc, srv)
}
func _GreeterBidirectionalStream_SayHello_Handler(srv interface{}, stream grpc.ServerStream) error {
func _GreeterBidirectionalStream_SayHello_Handler(srv any, stream grpc.ServerStream) error {
return srv.(GreeterBidirectionalStreamServer).SayHello(&greeterBidirectionalStreamSayHelloServer{stream})
}
@@ -167,7 +167,7 @@ func file_helloworld_proto_rawDescGZIP() []byte {
}
var file_helloworld_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_helloworld_proto_goTypes = []interface{}{
var file_helloworld_proto_goTypes = []any{
(*HelloRequest)(nil), // 0: helloworld.HelloRequest
(*HelloReply)(nil), // 1: helloworld.HelloReply
}
@@ -187,7 +187,7 @@ func file_helloworld_proto_init() {
return
}
if !protoimpl.UnsafeEnabled {
file_helloworld_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
file_helloworld_proto_msgTypes[0].Exporter = func(v any, i int) any {
switch v := v.(*HelloRequest); i {
case 0:
return &v.state
@@ -199,7 +199,7 @@ func file_helloworld_proto_init() {
return nil
}
}
file_helloworld_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
file_helloworld_proto_msgTypes[1].Exporter = func(v any, i int) any {
switch v := v.(*HelloReply); i {
case 0:
return &v.state
@@ -283,7 +283,7 @@ func RegisterGreeterServer(s *grpc.Server, srv GreeterServer) {
s.RegisterService(&_Greeter_serviceDesc, srv)
}
func _Greeter_SayHello_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
func _Greeter_SayHello_Handler(srv any, ctx context.Context, dec func(any) error, interceptor grpc.UnaryServerInterceptor) (any, error) {
in := new(HelloRequest)
if err := dec(in); err != nil {
return nil, err
@@ -295,7 +295,7 @@ func _Greeter_SayHello_Handler(srv interface{}, ctx context.Context, dec func(in
Server: srv,
FullMethod: "/helloworld.Greeter/SayHello",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
handler := func(ctx context.Context, req any) (any, error) {
return srv.(GreeterServer).SayHello(ctx, req.(*HelloRequest))
}
return interceptor(ctx, in, info, handler)
+3 -3
View File
@@ -87,14 +87,14 @@ func (c *ExampleController) GetPing() string {
// GetHello serves
// Method: GET
// Resource: http://localhost:8080/hello
func (c *ExampleController) GetHello() interface{} {
func (c *ExampleController) GetHello() any {
return map[string]string{"message": "Hello Iris!"}
}
// GetHelloWorld serves
// Method: GET
// Resource: http://localhost:8080/hello/world
func (c *ExampleController) GetHelloWorld() interface{} {
func (c *ExampleController) GetHelloWorld() any {
return map[string]string{"message": "Hello Iris! DefaultPath"}
}
@@ -128,7 +128,7 @@ type ExampleControllerCustomPath struct{}
// GetHelloWorld serves
// Method: GET
// Resource: http://localhost:8080/helloWorld
func (c *ExampleControllerCustomPath) GetHelloWorld() interface{} {
func (c *ExampleControllerCustomPath) GetHelloWorld() any {
return map[string]string{"message": "Hello Iris! CustomPath"}
}
@@ -157,7 +157,7 @@ func (c *Controller) renderNotFound(id int64) mvc.View {
// in order to be able to return a type of `Model`
// as mvc.Result.
// If this function didn't exist then
// we should explicit set the output result to that Model or to an interface{}.
// we should explicit set the output result to that Model or to an any.
func (u Model) Dispatch(ctx iris.Context) {
ctx.JSON(u)
}
@@ -182,7 +182,7 @@ func (c *Controller) GetBy(userID int64) mvc.Result {
// either a user which returns the Model as JSON via its Dispatch.
//
// We could also return just a struct value that is not an mvc.Result,
// if the output result of the `GetBy` was that struct's type or an interface{}
// if the output result of the `GetBy` was that struct's type or an any
// and iris would render that with JSON as well, but here we can't do that without complete the `Dispatch`
// function, because we may return an mvc.View which is an mvc.Result.
return user
@@ -77,11 +77,11 @@ func (c *UsersController) PutBy(id int64) (datamodels.User, error) {
// DeleteBy deletes a user.
// Demo:
// curl -i -X DELETE -u admin:password http://localhost:8080/users/1
func (c *UsersController) DeleteBy(id int64) interface{} {
func (c *UsersController) DeleteBy(id int64) any {
wasDel := c.Service.DeleteByID(id)
if wasDel {
// return the deleted user's ID
return map[string]interface{}{"deleted": id}
return map[string]any{"deleted": id}
}
// right here we can see that a method function
// can return any of those two types(map or int),
+1 -1
View File
@@ -1,6 +1,6 @@
module app
go 1.24.3
go 1.25
require github.com/kataras/iris/v12 v12.2.11-0.20250430051100-af9c8213980c
@@ -14,7 +14,7 @@ type HelloController struct{}
var helloView = mvc.View{
Name: "hello/index.html",
Data: map[string]interface{}{
Data: map[string]any{
"Title": "Hello Page",
"MyMessage": "Welcome to my awesome website",
},
@@ -67,7 +67,7 @@ func (c *MovieController) PutBy(ctx iris.Context, id int64) (datamodels.Movie, e
// DeleteBy deletes a movie.
// Demo:
// curl -i -X DELETE -u admin:password http://localhost:8080/movies/1
func (c *MovieController) DeleteBy(id int64) interface{} {
func (c *MovieController) DeleteBy(id int64) any {
wasDel := c.Service.DeleteByID(id)
if wasDel {
// return the deleted movie's ID
+1 -1
View File
@@ -1,6 +1,6 @@
module github.com/kataras/iris/v12/_examples/mvc/vuejs-todo-mvc/src
go 1.24.3
go 1.25
require github.com/kataras/iris/v12 v12.2.11-0.20250430051100-af9c8213980c
+1 -1
View File
@@ -1,6 +1,6 @@
module github.com/username/project
go 1.24.3
go 1.25
require (
github.com/kataras/golog v0.1.13
@@ -10,7 +10,7 @@
// See here: https://godoc.org/go.mongodb.org/mongo-driver/bson/primitive#ObjectID.MarshalJSON.
//
// To register a converter import the github.com/iris-contrib/schema and call
// schema.Query.RegisterConverter(value interface{}, converterFunc Converter).
// schema.Query.RegisterConverter(value any, converterFunc Converter).
//
// The Converter is just a type of func(string) reflect.Value.
//
@@ -44,7 +44,7 @@ var DefaultBodyDecoder = myBodyDecoder{}
// we will use the simplest `context#UnmarshalerFunc` to pass just the yaml.Unmarshal.
//
// Can be used as: ctx.UnmarshalBody(&c, DefaultBodyDecoder)
func (r *myBodyDecoder) Unmarshal(data []byte, outPtr interface{}) error {
func (r *myBodyDecoder) Unmarshal(data []byte, outPtr any) error {
return yaml.Unmarshal(data, outPtr)
}
*/
+1 -1
View File
@@ -42,7 +42,7 @@ func logAllBody(ctx iris.Context) {
}
func logJSON(ctx iris.Context) {
var p interface{}
var p any
if err := ctx.ReadJSON(&p); err == nil {
ctx.Application().Logger().Infof("logJSON: %#+v", p)
}
+1 -1
View File
@@ -1,6 +1,6 @@
module github.com/kataras/iris/_examples/response-writer/json-third-party
go 1.24.3
go 1.25
require (
github.com/bytedance/sonic v1.13.2
+1 -1
View File
@@ -16,7 +16,7 @@ func applyIrisGlobalPatches() {
// Apply global modifications to the context REST writers
// without modifications to your web server's handlers code.
iris.Patches().Context().Writers().JSON(func(ctx iris.Context, v interface{}, options *iris.JSON) error {
iris.Patches().Context().Writers().JSON(func(ctx iris.Context, v any, options *iris.JSON) error {
enc := json.NewEncoder(ctx.ResponseWriter())
enc.SetEscapeHTML(!options.UnescapeHTML)
enc.SetIndent("", options.Indent)
+1 -1
View File
@@ -1,6 +1,6 @@
module app
go 1.24.3
go 1.25
require (
github.com/golang/protobuf v1.5.3
@@ -145,7 +145,7 @@ func file_hello_proto_rawDescGZIP() []byte {
}
var file_hello_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_hello_proto_goTypes = []interface{}{
var file_hello_proto_goTypes = []any{
(*HelloRequest)(nil), // 0: protos.HelloRequest
(*HelloReply)(nil), // 1: protos.HelloReply
}
@@ -163,7 +163,7 @@ func file_hello_proto_init() {
return
}
if !protoimpl.UnsafeEnabled {
file_hello_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
file_hello_proto_msgTypes[0].Exporter = func(v any, i int) any {
switch v := v.(*HelloRequest); i {
case 0:
return &v.state
@@ -175,7 +175,7 @@ func file_hello_proto_init() {
return nil
}
}
file_hello_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
file_hello_proto_msgTypes[1].Exporter = func(v any, i int) any {
switch v := v.(*HelloReply); i {
case 0:
return &v.state
+1 -1
View File
@@ -78,7 +78,7 @@ func newApp() *iris.Application {
return
}
ctx.JSON(map[string]interface{}{
ctx.JSON(map[string]any{
// you can pass any custom structured go value of course.
"user_id": userID,
})
+1 -1
View File
@@ -35,7 +35,7 @@ func TestRoutingBasic(t *testing.T) {
expectedUUintResponse = expectedUResponse("uid", "uint", "42")
expectedUAlphabeticalResponse = expectedUResponse("firstname", "alphabetical", "abcd")
expectedAPIUsersIndexResponse = map[string]interface{}{"user_id": 42}
expectedAPIUsersIndexResponse = map[string]any{"user_id": 42}
expectedAdminIndexResponse = "<h1>Hello from admin/</h1>"
+1 -1
View File
@@ -80,7 +80,7 @@ func (c *myCustomContext) SetContext(ctx iris.Context) {
c.Context = ctx
}
func (c *myCustomContext) HTML(format string, args ...interface{}) (int, error) {
func (c *myCustomContext) HTML(format string, args ...any) (int, error) {
c.Application().Logger().Info("HTML was called from custom Context")
return c.Context.HTML(fmt.Sprintf(format, args...))
+1 -1
View File
@@ -112,6 +112,6 @@ func problemExample(ctx iris.Context) {
// retry-after based on the request. Useful for ProblemOptions reusability.
// Overrides the RetryAfter field.
//
// RetryAfterFunc: func(iris.Context) interface{} { [...] }
// RetryAfterFunc: func(iris.Context) any { [...] }
})
}
+3 -3
View File
@@ -17,7 +17,7 @@ func main() {
app := iris.New()
app.Logger().SetLevel("debug")
app.Macros().Register("slice", "", []string{}, false, true, func(paramValue string) (interface{}, bool) {
app.Macros().Register("slice", "", []string{}, false, true, func(paramValue string) (any, bool) {
return strings.Split(paramValue, "/"), true
}).RegisterFunc("contains", func(expectedItems []string) func(paramValue []string) bool {
sort.Strings(expectedItems)
@@ -39,10 +39,10 @@ func main() {
// In order to use your new param type inside MVC controller's function input argument or a hero function input argument
// you have to tell the Iris what type it is, the `ValueRaw` of the parameter is the same type
// as you defined it above with the func(paramValue string) (interface{}, bool).
// as you defined it above with the func(paramValue string) (any, bool).
// The new value and its type(from string to your new custom type) it is stored only once now,
// you don't have to do any conversions for simple cases like this.
context.ParamResolvers[reflect.TypeOf([]string{})] = func(paramIndex int) interface{} {
context.ParamResolvers[reflect.TypeOf([]string{})] = func(paramIndex int) any {
return func(ctx iris.Context) []string {
// When you want to retrieve a parameter with a value type that it is not supported by-default, such as ctx.Params().GetInt
// then you can use the `GetEntry` or `GetEntryAt` and cast its underline `ValueRaw` to the desired type.
+1 -1
View File
@@ -1,6 +1,6 @@
module github.com/kataras/iris/_examples/routing/party-controller
go 1.24.3
go 1.25
require github.com/kataras/iris/v12 v12.2.11-0.20250430051100-af9c8213980c
@@ -1,6 +1,6 @@
module github.com/kataras/iris/_examples/routing/subdomains/redirect/multi-instances
go 1.24.3
go 1.25
require github.com/kataras/iris/v12 v12.2.11-0.20250430051100-af9c8213980c
+2 -2
View File
@@ -30,8 +30,8 @@ func main() {
// * bool, for booleans
// * float64, for numbers
// * string, for strings
// * []interface{}, for arrays
// * map[string]interface{}, for objects.
// * []any, for arrays
// * map[string]any, for objects.
// If you want to save the data per go-specific types
// you should change the DefaultTranscoder to the GobTranscoder one:
// sessions.DefaultTranscoder = sessions.GobTranscoder{}
+1 -1
View File
@@ -1,6 +1,6 @@
module app
go 1.24.3
go 1.25
require github.com/kataras/iris/v12 v12.2.11-0.20250430051100-af9c8213980c
@@ -27,7 +27,7 @@ func NewApp(sess *sessions.Sessions) *iris.Application {
}
ctx.HTML("<ul>")
session.Visit(func(key string, value interface{}) {
session.Visit(func(key string, value any) {
ctx.HTML(fmt.Sprintf("<li> %s = %v </li>", key, value))
})
@@ -96,7 +96,7 @@ func NewApp(sess *sessions.Sessions) *iris.Application {
session := sessions.Get(ctx)
key := ctx.Params().Get("key")
var value interface{}
var value any
switch ctx.Params().Get("type") {
case "int":
+1 -1
View File
@@ -1,6 +1,6 @@
module ginkgotest
go 1.24.3
go 1.25
require (
github.com/kataras/iris/v12 v12.2.11-0.20250430051100-af9c8213980c
+1 -1
View File
@@ -7,7 +7,7 @@ import (
)
// Panic panics, change it if you don't want to panic on critical INITIALIZE-ONLY-ERRORS
var Panic = func(v interface{}) {
var Panic = func(v any) {
panic(v)
}
@@ -77,7 +77,7 @@ func (fi bindataFileInfo) IsDir() bool {
}
// Sys return file is sys mode
func (fi bindataFileInfo) Sys() interface{} {
func (fi bindataFileInfo) Sys() any {
return nil
}
+1 -1
View File
@@ -67,7 +67,7 @@ func main() {
Name string
Age int
Items []string
Map map[string]interface{}
Map map[string]any
Nested book
}{
"Example Name",
@@ -8,7 +8,7 @@ import (
// Hello renders our ../templates/hello.qtpl file using the compiled ../templates/hello.qtpl.go file.
func Hello(ctx iris.Context) {
// vars := make(map[string]interface{})
// vars := make(map[string]any)
// vars["message"] = "Hello World!"
// vars["name"] = ctx.Params().Get("name")
// [...]
@@ -2,7 +2,7 @@ Hello template, implements the Partial's methods.
{% code
type Hello struct {
Vars map[string]interface{}
Vars map[string]any
}
%}

Some files were not shown because too many files have changed in this diff Show More