string:可以是一个空字符串,但不能为nil,使用时比较安全 (字符串类型)
*string:可以为nil,使用的时候需要判断是否有值(字符串指针类型)
使用区别:
type LoginSearch struct {
Id string
Name *int
request.PageInfo
}
if LoginSearch.Id != "" {
xxxxx
}
if LoginSearch.Name != nil {
xxxxx
}