I have a hard time understanding the difference between the two:
var requestPayLoad struct { Email string `json:"email"` Password string `json:"string"` }
and:
type jwtUSer struct { ID int `json:"id"` FirstName string `json:"first_name"` LastName string `json:"last_name"` }
One is a type and the other is a variable.
var v T
Create a variable, bind the identifier v
to it, give it T
, and then It is initialized to a zero value
of T. type t T
Binds the identifier T
to the type T
. In both cases, the T
type can be a named or unnamed (anonymous) type.
The above is the detailed content of Difference between var Foo structure and type Foo structure. For more information, please follow other related articles on the PHP Chinese website!