// PreviewComments returns string slice or single string (inside Comment slice)
// Depending on PreviewComments parameter.
// If PreviewComments are string or []string only the Text field will be filled.
PreviewComments returns string slice or single string (inside Comment slice)
Depending on PreviewComments parameter.
If PreviewComments are string or []string only the Text field will be filled.
// PreviewComments returns string slice or single string ( inside Comment slice ) // Depending on PreviewComments parameter . // If PreviewComments are string or [] string only the Text field will be filled .
func (item *Item) PreviewComments() []Comment {
	switch s := item.Previewcomments.(type) {
	case []Comment:
		return s
	case []string:
		comments := make([]Comment, 0)
		for i := range s {
			comments = append(comments, Comment{
				Text: s[i],
			})
		}
		return comments
	case string:
		comments := []Comment{
			{
				Text: s,
			},
		}
		return comments
	}
	return nil
}
func ( item * Item ) PreviewComments ( ) [ ] Comment { switch s := item . Previewcomments . ( type ) { case [ ] Comment : return s case [ ] string : comments := make ( [ ] Comment , 0 ) for i := range s { comments = append ( comments , Comment { Text : s [ i ] , } ) } return comments case string : comments := [ ] Comment { { Text : s , } , } return comments } return nil }
PreviewComments returns string slice or single string (inside Comment slice)
Depending on PreviewComments parameter.
PreviewComments returns string slice or single string ( inside Comment slice ) Depending on PreviewComments parameter .