string function for user
parent
8907d30fe0
commit
f605a516c0
16
types.go
16
types.go
|
@ -26,6 +26,22 @@ type User struct {
|
||||||
UserName string `json:"username"`
|
UserName string `json:"username"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// String displays a simple text version of a user.
|
||||||
|
// It is normally a user's username,
|
||||||
|
// but falls back to a first/last name as available.
|
||||||
|
func (u *User) String() string {
|
||||||
|
if u.UserName != "" {
|
||||||
|
return u.UserName
|
||||||
|
}
|
||||||
|
|
||||||
|
name := u.FirstName
|
||||||
|
if u.LastName != "" {
|
||||||
|
name += " " + u.LastName
|
||||||
|
}
|
||||||
|
|
||||||
|
return name
|
||||||
|
}
|
||||||
|
|
||||||
// GroupChat is a group chat, and not currently in use.
|
// GroupChat is a group chat, and not currently in use.
|
||||||
type GroupChat struct {
|
type GroupChat struct {
|
||||||
ID int `json:"id"`
|
ID int `json:"id"`
|
||||||
|
|
Loading…
Reference in New Issue