Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion session/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,26 @@ import "net/http"
// _ = sess.SetString("idp.authenticated", "true")
// _ = sess.Save()
type Provider interface {
// GetString returns a session value based on the provided key.
// GetString returns a session value based on the provided key. If the key does
// not exist, the default or zero value will be returned (i.e, "").
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we start returning errors 😉 ? Like ErrNotFound and make that available in this pacakge?

GetString(key string) (string, error)

// GetBytes returns the []byte for a given key from the session data. If the key
// does not exist, the default or zero value will be returned (i.e, nil).
GetBytes(key string) ([]byte, error)

// GetAny returns a session value based the provided key. If the key does not
// exist, the default or zero value will be returned (i.e, nil). This method is
// mainly exposed for backwards compatibility any may be deprecated in the
// future.
GetAny(key string) (any, error)

// SetString adds a key and the corresponding string value to the session data.
SetString(key string, value string) error

// SetBytes adds a key and the corresponding []byte value to the session data.
SetBytes(key string, value []byte) error

// Save saves all changes from the changelog to the underlying session store.
Save() error
}
Expand Down