Adding Stringer interface to Objects
This commit is contained in:
parent
c3798bd94c
commit
1a028dc2b9
1 changed files with 10 additions and 1 deletions
9
imdb.go
9
imdb.go
|
@ -187,3 +187,12 @@ func checkErrorStatus(status int) error {
|
|||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
//Stringer Interface for MovieResult
|
||||
func (mr MovieResult) String() string {
|
||||
return fmt.Sprintf("#%s: %s (%s)", mr.ImdbID, mr.Title, mr.Year)
|
||||
}
|
||||
|
||||
func (sr SearchResult) String() string {
|
||||
return fmt.Sprintf("#%s: %s (%s) Type: %s", sr.ImdbId, sr.Title, sr.Year, sr.Type)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue