Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrorRegistry is a map of error codes to errors. // It is usually used in gopherpit.com/gopherpit/pkg/client.Client. ErrorRegistry = apiClient.NewMapErrorRegistry(nil) )
View Source
var ( // SessionNotFound is error if session does not exist. SessionNotFound = NewError(1000, "session not found") )
Functions ¶
This section is empty.
Types ¶
type Error ¶
type Error struct {
// Message is a text that describes an error.
Message string `json:"message"`
// Code is a number that identifies error.
// It allows error identification when serialization is involved.
Code int `json:"code"`
}
Error is a structure that holds error message and code.
type Options ¶
type Options struct {
Values *map[string]interface{} `json:"values,omitempty"`
MaxAge *int `json:"max-age,omitempty"`
}
Options is a structure with parameters as pointers to set session data. If a parameter is nil, the corresponding Session parameter will not be changed.
type Service ¶
type Service interface {
// Session retrieves a Session instance.
Session(id string) (*Session, error)
// CreateSession creates a new Session instance.
CreateSession(*Options) (*Session, error)
// UpdateSession changes data of an existing Session.
UpdateSession(id string, o *Options) (*Session, error)
// DeleteSession deletes an existing Session.
DeleteSession(id string) error
}
Service defines functions that Session provider must have.
type Session ¶
type Session struct {
// A unique Session ID.
ID string `json:"id"`
// A mapping of named arbitrary data that Session holds.
Values map[string]interface{} `json:"values,omitempty"`
// MaxAge is an integer that represents duration in seconds and
// can be used in setting expiration of a HTTP cookie.
MaxAge int `json:"max-age,omitempty"`
}
Session holds session ID and values associated.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package boltSession provides a Service that is using local BoltDB database to store Session data.
|
Package boltSession provides a Service that is using local BoltDB database to store Session data. |
|
Package httpSession provides a Service that is a HTTP client to an external session service that can respond to HTTP requests defined here.
|
Package httpSession provides a Service that is a HTTP client to an external session service that can respond to HTTP requests defined here. |
Click to show internal directories.
Click to hide internal directories.