func (favi *FavItem) GetFolder() *FavFolderItem {
	if ret, ok := favi.Item.(*FavFolderItem); ok {
		return ret
	}
	return nil
}
GetFolder tries to cast Item to FavFolderItem; return nil if it is not
package pttbbs
import (
	"github.com/Ptt-official-app/go-bbs"
	"bytes"
	"encoding"
	"encoding/binary"
	"errors"
	"fmt"
	"io/ioutil"
	"time"
)
const (
	TIME4TBytes             = 4  
	favPreAlloc             = 8
	sizeOfPttFavBoardBytes  = 12  
	sizeOfPttFavFolderBytes = 50  
	sizeOfPttFavLineBytes   = 1   
)
var (
	ErrInvalidFavType  = errors.New("invalid Favorite type")
	ErrIndexOutOfBound = errors.New("index out of range, file format invalid")
)
type FavItemType uint8
const (
	FavItemTypeBoard  FavItemType = 1  
	FavItemTypeFolder FavItemType = 2  
	FavItemTypeLine   FavItemType = 3  
)
type FavAttr uint8
const (
	FavhFav    FavAttr = 0x00000001  
	FavhTag    FavAttr = 0x00000002  
	FavhUnread FavAttr = 0x00000004  
	FavhAdmTag FavAttr = 0x00000008  
)
type FavItem struct {
	FavType FavItemType
	FavAttr uint8
	Item    interface{}  
}
func (favi *FavItem) BoardID() string {
	if favi.FavType != FavItemTypeBoard {
		return ""
	}
	return favi.Item.(*FavBoardItem).boardID
}
func (favi *FavItem) Title() string {
	if favi.FavType == FavItemTypeLine {
		return "------------------------------------------"
	}
	if favi.FavType == FavItemTypeFolder {
		return favi.Item.(*FavFolderItem).Title
	}
	return ""
}
func (favi *FavItem) Type() bbs.FavoriteType {
	switch favi.FavType {
	case FavItemTypeBoard:
		return bbs.FavoriteTypeBoard
	case FavItemTypeFolder:
		return bbs.FavoriteTypeFolder
	case FavItemTypeLine:
		return bbs.FavoriteTypeLine
	}
	return bbs.FavoriteTypeBoard
}
func (favi *FavItem) Records() []bbs.FavoriteRecord {
	if favi.FavType != FavItemTypeFolder {
		return nil
	}
	rec := favi.Item.(*FavFolderItem).ThisFolder.FavItems
	ret := make([]bbs.FavoriteRecord, len(rec))
	for i, v := range rec {
		ret[i] = v
	}
	return ret
}
func (favi *FavItem) GetBoard() *FavBoardItem {
	if ret, ok := favi.Item.(*FavBoardItem); ok {
		return ret
	}
	return nil
}