func (s *Store) Bool(r interface{}, err error) (bool, error) {
	if err != nil {
		return false, err
	}
	v, ok := r.(bool)
	if !ok {
		err = simplesessions.ErrAssertType
	}
	return v, err
}
Bool is a helper method to type assert as Bool
package memory
import (
	"sync"
	"github.com/vividvilla/simplesessions"
)
const (
	sessionIDLen = 32
)
type Store struct {
	sessions map[string]map[string]interface{}
	mu sync.RWMutex
}
func New() *Store {
	return &Store{
		sessions: make(map[string]map[string]interface{}),
	}
}
func (s *Store) isValidSessionID(sess *simplesessions.Session, id string) bool {
	return len(id) == sessionIDLen && sess.IsValidRandomString(id)
}
func (s *Store) IsValid(sess *simplesessions.Session, id string) (bool, error) {
	return s.isValidSessionID(sess, id), nil
}
func (s *Store) Create(sess *simplesessions.Session) (string, error) {
	id, err := sess.GenerateRandomString(sessionIDLen)
	if err != nil {
		return "", err
	}
	return id, err
}
func (s *Store) Get(sess *simplesessions.Session, id, key string) (interface{}, error) {
	if !s.isValidSessionID(sess, id) {
		return nil, simplesessions.ErrInvalidSession
	}
	var val interface{}
	s.mu.RLock()
	v, ok := s.sessions[id]
	if ok && v != nil {
		val, ok = s.sessions[id][key]
	}
	s.mu.RUnlock()
	if !ok || v == nil {
		return nil, simplesessions.ErrFieldNotFound
	}
	return val, nil
}
func (s *Store) GetMulti(sess *simplesessions.Session, id string, keys ...string) (map[string]interface{}, error) {
	if !s.isValidSessionID(sess, id) {
		return nil, simplesessions.ErrInvalidSession
	}
	s.mu.RLock()
	defer s.mu.RUnlock()
	sVals, ok := s.sessions[id]
	if sVals == nil || !ok {
		sVals = make(map[string]interface{})
	}
	res := make(map[string]interface{})
	for _, k := range keys {
		v, ok := sVals[k]
		if !ok {
			res[k] = nil
		} else {
			res[k] = v
		}
	}
	return res, nil
}
func (s *Store) GetAll(sess *simplesessions.Session, id string) (map[string]interface{}, error) {
	if !s.isValidSessionID(sess, id) {
		return nil, simplesessions.ErrInvalidSession
	}
	s.mu.RLock()
	defer s.mu.RUnlock()
	vals := s.sessions[id]
	return vals, nil
}
func (s *Store) Set(sess *simplesessions.Session, id, key string, val interface{}) error {
	if !s.isValidSessionID(sess, id) {
		return simplesessions.ErrInvalidSession
	}
	s.mu.Lock()
	defer s.mu.Unlock()
	_, ok := s.sessions[id]
	if !ok {
		s.sessions[id] = make(map[string]interface{})
	}
	s.sessions[id][key] = val
	return nil
}
func (s *Store) Commit(sess *simplesessions.Session, id string) error {
	return nil
}
func (s *Store) Delete(sess *simplesessions.Session, id string, key string) error {
	if !s.isValidSessionID(sess, id) {
		return simplesessions.ErrInvalidSession
	}
	s.mu.Lock()
	defer s.mu.Unlock()
	_, ok := s.sessions[id]
	if ok && s.sessions[id] != nil {
		_, ok = s.sessions[id][key]
		if ok {
			delete(s.sessions[id], key)
		}
	}
	return nil
}
func (s *Store) Clear(sess *simplesessions.Session, id string) error {
	if !s.isValidSessionID(sess, id) {
		return simplesessions.ErrInvalidSession
	}
	s.mu.Lock()
	defer s.mu.Unlock()
	_, ok := s.sessions[id]
	if ok {
		delete(s.sessions, id)
	}
	return nil
}
func (s *Store) Int(r interface{}, err error) (int, error) {
	if err != nil {
		return 0, err
	}
	v, ok := r.(int)
	if !ok {
		err = simplesessions.ErrAssertType
	}
	return v, err
}
func (s *Store) Int64(r interface{}, err error) (int64, error) {
	if err != nil {
		return 0, err
	}
	v, ok := r.(int64)
	if !ok {
		err = simplesessions.ErrAssertType
	}
	return v, err
}
func (s *Store) UInt64(r interface{}, err error) (uint64, error) {
	if err != nil {
		return 0, err
	}
	v, ok := r.(uint64)
	if !ok {
		err = simplesessions.ErrAssertType
	}
	return v, err
}
func (s *Store) Float64(r interface{}, err error) (float64, error) {
	if err != nil {
		return 0, err
	}
	v, ok := r.(float64)
	if !ok {
		err = simplesessions.ErrAssertType
	}
	return v, err
}
func (s *Store) String(r interface{}, err error) (string, error) {
	if err != nil {
		return "", err
	}
	v, ok := r.(string)
	if !ok {
		err = simplesessions.ErrAssertType
	}
	return v, err
}
func (s *Store) Bytes(r interface{}, err error) ([]byte, error) {
	if err != nil {
		return nil, err
	}
	v, ok := r.([]byte)
	if !ok {
		err = simplesessions.ErrAssertType
	}
	return v, err
}