Documentation ¶
Index ¶
- func Delete(c *fiber.Ctx, key string)
- func Destroy(c *fiber.Ctx)
- func Get[T any](c *fiber.Ctx, key string) (T, bool)
- func GetID(c *fiber.Ctx) string
- func GetInt(c *fiber.Ctx, key string) int
- func GetIntOnce(c *fiber.Ctx, key string) int
- func GetOnce[T any](c *fiber.Ctx, key string) (T, bool)
- func GetOnceOrDefault[T any](c *fiber.Ctx, key string) T
- func GetOrDefault[T any](c *fiber.Ctx, key string) T
- func GetString(c *fiber.Ctx, key string) string
- func GetStringOnce(c *fiber.Ctx, key string) string
- func GetUint(c *fiber.Ctx, key string) uint
- func GetUintOnce(c *fiber.Ctx, key string) uint
- func Init(sessionConfig *Config, dbConfig *db.Config)
- func Set[T any](c *fiber.Ctx, key string, value T)
- func SetErrorHandler(f func(err error))
- type Config
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Delete ¶ added in v1.1.0
func Delete(c *fiber.Ctx, key string)
Delete deletes a value from the session.
func Get ¶
Get fetches a value from the session and casts it to T, returning the value and a boolean indicating whether the value was present in the session.
func GetInt ¶
GetInt fetches an int from the session, returning 0 if it isn't found. If you need to be able to differentiate between absence and 0, use Get.
func GetIntOnce ¶
GetIntOnce fetches an int from the session and then deletes it from the session. If you need to be able to differentiate between absence and 0, use GetOnce.
func GetOnce ¶
GetOnce fetches a value from the session and casts it to T, then deletes it from the session.
func GetOnceOrDefault ¶
GetOnceOrDefault fetches a value from the session and casts it to T, returning the value or the default value for the type if it was not present in the session.
func GetOrDefault ¶
GetOrDefault fetches a value from the session and casts it to T, returning the value or the default value for the type if it was not present in the session.
func GetString ¶
GetString fetches a string from the session, returning the empty string if it isn't found. If you need to be able to differentiate between absence and the empty string, use Get.
func GetStringOnce ¶
GetStringOnce fetches a string from the session and then deletes it from the session. If you need to be able to differentiate between absence and the empty string, use GetOnce.
func GetUint ¶ added in v1.1.0
GetUint fetches a uint from the session, returning 0 if it isn't found. If you need to be able to differentiate between absence and 0, use Get.
func GetUintOnce ¶ added in v1.1.0
GetUintOnce fetches an int from the session and then deletes it from the session. If you need to be able to differentiate between absence and 0, use GetOnce.
func Set ¶
Set stores a value in the session. If T is a custom type then it may need to be registered with gob.Register first.
func SetErrorHandler ¶
func SetErrorHandler(f func(err error))
SetErrorHandler sets a function to be called if any session operations fail. Set to nil to use the default (panic).