Upgrading To v1.10 From v1.9
Last updated
Last updated
[[toc]]
Estimated Upgrade Time: 20 Minutes
Update dependencies in the go.mod
file:
Version: v1.10.0
Add facades.Crypt
:
Version: v1.10.0
Add facades.Hash
:
Version: v1.10.0
Version: v1.10.0
The facades.Route.Run
method no longer needs to pass parameters, by default use http.host
and http.port
(you don't need to modify the code, it's backward compatible);
The facades.Route.RunTLS
method no longer needs to pass parameters, by default use http.tls.host
, http.tls.port
, http.tls.ssl.cert
and http.tls.ssl.key
, if you are using it, you need to modify the code;
Move app.url
, app.host
to http.url
, http.host
;
Version: v1.10.0
The facades.Grpc.Run
method no longer needs to pass parameters, by default use grpc.host
and grpc.port
(you don't need to modify the code, it's backward compatible);
Version: v1.10.0
Version: v1.10.0
The Input
method is changed from only getting routing parameters to getting data according to the following order: json
, form
, query
, route
。Note: json
can only get one-dimensional data, otherwise it will return empty;
Add Route
method to replace the original Input
method;
The default value of Query
and Form
methods are modified to be unnecessary;
Add methods as shown below:
Route
RouteInt
RouteInt64
QueryInt
QueryInt64
QueryBool
InputInt
InputInt64
InputBool
Json
Version: v1.10.0
Version: v1.10.0
Add new keys to connection
of config/database.go
:
prefix
: Set prefix for table name; singular
: Set the table name to use singular or plural;
Version: v1.10.0
You can quickly start the service with the following command:
Version: v1.10.0
Add the following methods:
FirstOr
FirstOrNew
FirstOrFail
UpdateOrCreate
An error was reported like this before, but now it's supported:
Version: v1.10.0
Previously, only one SQL statement was supported in the migration file, but now multiple statements are supported.
Version: v1.10.0
Version: v1.10.0
You can use status codes such as http.StatusOK
directly in controller without importing net/http
.
Version: v1.10.0
The APP_KEY
in the .env
file is changed to required, you can run command to generate the APP_KEY: go run . artisan key:generate
.
Version: v1.10.0
Add ctx http.Context
parameter to the methods under Form Request: Rules
, Messages
, Attributes
, PrepareForValidation
, allows you to do more custom configurations.
Version: v1.10.0
err := facades.Auth.Parse(ctx, token)
change to payload, err := facades.Auth.Parse(ctx, token)
, through payload
you can get:
Guard
: Current Guard;
Key
: User flag;
ExpireAt
: Expire time;
IssuedAt
: Issued time;
Version: v1.10.0
The following methods add *Result
return value to get the number of affected rows:
add &crypt.ServiceProvider{}
to the providers
item in the file;
add &hash.ServiceProvider{}
to the providers
item in the file;
Add file;
Add config/http.go
configuration, ;
Add facades.Route.RunTLSWithCert
method, ;
Add print
configuration to single
, daily
channel in the config/logging.go
file, it can control log output to console, ;
Add Delay
method,
Model
supports specify table name, ;
Add minio configuration, .