comparison pkg/models/user.go @ 5712:6270951dda28 revive-cleanup

/interface{}/any/
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Tue, 20 Feb 2024 22:37:51 +0100
parents f0c668bc4082
children
comparison
equal deleted inserted replaced
5711:2dd155cc95ec 5712:6270951dda28
102 func (e Email) Value() (driver.Value, error) { 102 func (e Email) Value() (driver.Value, error) {
103 return string(e), nil 103 return string(e), nil
104 } 104 }
105 105
106 // Scan implements the sql.Scanner interface. 106 // Scan implements the sql.Scanner interface.
107 func (e *Email) Scan(src interface{}) (err error) { 107 func (e *Email) Scan(src any) (err error) {
108 if s, ok := src.(string); ok { 108 if s, ok := src.(string); ok {
109 *e = Email(s) 109 *e = Email(s)
110 } else { 110 } else {
111 err = errNoString 111 err = errNoString
112 } 112 }
132 } 132 }
133 return errNoValidUser 133 return errNoValidUser
134 } 134 }
135 135
136 // Scan implements the sql.Scanner interface. 136 // Scan implements the sql.Scanner interface.
137 func (u *UserName) Scan(src interface{}) (err error) { 137 func (u *UserName) Scan(src any) (err error) {
138 if s, ok := src.(string); ok { 138 if s, ok := src.(string); ok {
139 *u = UserName(s) 139 *u = UserName(s)
140 } else { 140 } else {
141 err = errNoString 141 err = errNoString
142 } 142 }
156 func (r Role) Value() (driver.Value, error) { 156 func (r Role) Value() (driver.Value, error) {
157 return string(r), nil 157 return string(r), nil
158 } 158 }
159 159
160 // Scan implements the sql.Scanner interface. 160 // Scan implements the sql.Scanner interface.
161 func (r *Role) Scan(src interface{}) (err error) { 161 func (r *Role) Scan(src any) (err error) {
162 if s, ok := src.(string); ok { 162 if s, ok := src.(string); ok {
163 *r = Role(s) 163 *r = Role(s)
164 } else { 164 } else {
165 err = errNoString 165 err = errNoString
166 } 166 }