session

package
v0.0.0-...-1ad4281 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 11, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoggedIn

func LoggedIn(c *fiber.Ctx) bool

LoggedIn User

func ToContext

func ToContext(c *fiber.Ctx)

ToContext set user session to context

Types

type Session

type Session struct {
	LoggedIn   bool        `msg:"loggedIn" json:"loggedIn"`
	UserID     int64       `msg:"userId" json:"userId"`
	Perms      perms.Perms `msg:"perms" json:"perms"`
	LoginToken []byte      `msg:"loginToken" json:"-"`
	NotNew     bool        `msg:"notNew"  json:"notNew"`
}

Session user session struct

func Context

func Context(c *fiber.Ctx) *Session

Context get user session from fiber context

func Get

func Get(c *fiber.Ctx) *Session

Get get session from store attempt auth login on New session

func New

func New(c *fiber.Ctx, userID int64) (*Session, error)

New new session

func (*Session) DecodeMsg

func (z *Session) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*Session) EncodeMsg

func (z *Session) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*Session) MarshalMsg

func (z *Session) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*Session) Msgsize

func (z *Session) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*Session) ToStore

func (s *Session) ToStore(c *fiber.Ctx) error

ToStore set user session to session store

func (*Session) UnmarshalMsg

func (z *Session) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL