From 001757e554e1ffcc55faebf0ff9476f988649d41 Mon Sep 17 00:00:00 2001 From: Donnie Adams Date: Mon, 6 Jul 2015 11:08:43 -0700 Subject: [PATCH] Add a way for User type to string itself --- types.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/types.go b/types.go index a662f54..c53fa6a 100644 --- a/types.go +++ b/types.go @@ -55,6 +55,19 @@ type User struct { UserName string `json:"username"` } +func (u User) String() string { + str string + if u.FirstName != "" { + str += u.FirstName + if u.LastName != "" { + str += u.LastName + } + } else { + str += u.UserName + } + return str +} + // GroupChat is a group chat, and not currently in use. type GroupChat struct { ID int `json:"id"`