{"modulePath":"github.com/tdevco/echo-session","version":"v3.2.0+incompatible","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package session\n\n## Constants\n\n```go\nconst (\n\tDefaultKey = \"session_key\"\n)\n```\n\n## Functions\n\n```go\nfunc Sessions(name string, store Store) echo.MiddlewareFunc\n```\n\n## Types\n\n```go\ntype CookieStore interface {\n\tStore\n}\n```\n\n```go\nfunc NewCookieStore(keyPairs ...[]byte) CookieStore\n```\nKeys are defined in pairs to allow key rotation, but the common case is to set a single authentication key and optionally an encryption key.\n\nThe first key in a pair is used for authentication and the second for encryption. The encryption key can be set to nil or omitted in the last pair, but the authentication key is required in all pairs.\n\nIt is recommended to use an authentication key with 32 or 64 bytes. The encryption key, if set, must be either 16, 24, or 32 bytes to select AES-128, AES-192, or AES-256 modes.\n\n```go\ntype FileSystemStore interface {\n\tStore\n\tMaxLength(int)\n}\n```\n\n```go\nfunc NewFileSystemStoreStore(path string, keyPairs ...[]byte) FileSystemStore\n```\nThe path argument is the directory where sessions will be saved. If empty it will use os.TempDir().\n\nKeys are defined in pairs to allow key rotation, but the common case is to set a single authentication key and optionally an encryption key.\n\nThe first key in a pair is used for authentication and the second for encryption. The encryption key can be set to nil or omitted in the last pair, but the authentication key is required in all pairs.\n\nIt is recommended to use an authentication key with 32 or 64 bytes. The encryption key, if set, must be either 16, 24, or 32 bytes to select AES-128, AES-192, or AES-256 modes.\n\n```go\ntype Options struct {\n\tPath   string\n\tDomain string\n\t// MaxAge=0 means no 'Max-Age' attribute specified.\n\t// MaxAge\u003c0 means delete cookie now, equivalently 'Max-Age: 0'.\n\t// MaxAge\u003e0 means Max-Age attribute present and given in seconds.\n\tMaxAge   int\n\tSecure   bool\n\tHttpOnly bool\n}\n```\nOptions stores configuration for a session or session store. Fields are a subset of http.Cookie fields.\n\n```go\ntype PostgresStore interface {\n\tStore\n}\n```\n\n```go\nfunc NewPostgresStore(dbURL string, keyPairs ...[]byte) (PostgresStore, error)\n```\n\n```go\ntype RedisStore interface {\n\tStore\n}\n```\n\n```go\nfunc NewRedisStore(size int, network, address, password string, keyPairs ...[]byte) (RedisStore, error)\n```\nsize: maximum number of idle connections. network: tcp or udp address: host:port password: redis-password Keys are defined in pairs to allow key rotation, but the common case is to set a single authentication key and optionally an encryption key.\n\nThe first key in a pair is used for authentication and the second for encryption. The encryption key can be set to nil or omitted in the last pair, but the authentication key is required in all pairs.\n\nIt is recommended to use an authentication key with 32 or 64 bytes. The encryption key, if set, must be either 16, 24, or 32 bytes to select AES-128, AES-192, or AES-256 modes.\n\n```go\nfunc NewRedisStoreWithDB(size int, network, address, password string, DB string, keyPairs ...[]byte) (RedisStore, error)\n```\nsize: maximum number of idle connections. network: tcp or udp address: host:port password: redis-password Keys are defined in pairs to allow key rotation, but the common case is to set a single authentication key and optionally an encryption key. DB: database index\n\nThe first key in a pair is used for authentication and the second for encryption. The encryption key can be set to nil or omitted in the last pair, but the authentication key is required in all pairs.\n\nIt is recommended to use an authentication key with 32 or 64 bytes. The encryption key, if set, must be either 16, 24, or 32 bytes to select AES-128, AES-192, or AES-256 modes.\n\n```go\nfunc NewRedisStoreWithPool(pool *redis.Pool, keyPairs ...[]byte) (RedisStore, error)\n```\npool: redis pool connections Keys are defined in pairs to allow key rotation, but the common case is to set a single authentication key and optionally an encryption key.\n\nThe first key in a pair is used for authentication and the second for encryption. The encryption key can be set to nil or omitted in the last pair, but the authentication key is required in all pairs.\n\nIt is recommended to use an authentication key with 32 or 64 bytes. The encryption key, if set, must be either 16, 24, or 32 bytes to select AES-128, AES-192, or AES-256 modes.\n\n```go\ntype Session interface {\n\t// Get returns the session value associated to the given key.\n\tGet(key interface{}) interface{}\n\t// Set sets the session value associated to the given key.\n\tSet(key interface{}, val interface{})\n\t// Delete removes the session value associated to the given key.\n\tDelete(key interface{})\n\t// Clear deletes all values in the session.\n\tClear()\n\t// AddFlash adds a flash message to the session.\n\t// A single variadic argument is accepted, and it is optional: it defines the flash key.\n\t// If not defined \"_flash\" is used by default.\n\tAddFlash(value interface{}, vars ...string)\n\t// Flashes returns a slice of flash messages from the session.\n\t// A single variadic argument is accepted, and it is optional: it defines the flash key.\n\t// If not defined \"_flash\" is used by default.\n\tFlashes(vars ...string) []interface{}\n\t// Options sets confuguration for a session.\n\tOptions(Options)\n\t// Save saves all sessions used during the current request.\n\tSave() error\n}\n```\nSession stores the values and optional configuration for a session.\n\n```go\nfunc Default(ctx echo.Context) Session\n```\nshortcut to get session\n\n```go\ntype Store interface {\n\tsessions.Store\n\tOptions(Options)\n\tMaxAge(int)\n}\n```\n\n","path":"github.com/tdevco/echo-session","name":"session","synopsis":"","isRedistributable":true}
