mirror of
https://github.com/kataras/iris.git
synced 2025-12-20 03:17:04 +00:00
update dependencies
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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,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,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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user