func (s *Service) FetchSessionIDFromRequest(r *http.Request) (string, error) {
	sessionCookie, err := r.Cookie(s.options.CookieName)
	if err != nil {
		if err == http.ErrNoCookie {
			return "", ErrNoSessionOnRequest
		}
		return "", err
	}
	return sessionCookie.Value, nil
}
FetchSessionIDFromRequest retrieves a signed session id from a request
package transport
import (
	"errors"
	"net/http"
	"time"
	"github.com/adam-hanna/sessions/user"
)
const (
	DefaultCookieName = "session"
	DefaultCookiePath = "/"
)
var ErrNoSessionOnRequest = errors.New("no session on request")
type Service struct {
	options Options
}
type Options struct {
	CookieName string
	CookiePath string
	HTTPOnly   bool
	Secure     bool
}
func New(options Options) *Service {
	setDefaultOptions(&options)
	return &Service{
		options: options,
	}
}
func (s *Service) SetSessionOnResponse(signedSessionID string, userSession *user.Session, w http.ResponseWriter) error {
	sessionCookie := http.Cookie{
		Name:     s.options.CookieName,
		Value:    signedSessionID,
		Expires:  userSession.ExpiresAt,
		Path:     s.options.CookiePath,
		HttpOnly: s.options.HTTPOnly,
		Secure:   s.options.Secure,
	}
	http.SetCookie(w, &sessionCookie)
	return nil
}
func (s *Service) DeleteSessionFromResponse(w http.ResponseWriter) error {
	aLongTimeAgo := time.Now().Add(-1000 * time.Hour)
	nullSessionCookie := http.Cookie{
		Name:     s.options.CookieName,
		Value:    "",
		Expires:  aLongTimeAgo,
		Path:     s.options.CookiePath,
		HttpOnly: s.options.HTTPOnly,
		Secure:   s.options.Secure,
	}
	http.SetCookie(w, &nullSessionCookie)
	return nil
}