visitor

package
v0.0.0-...-84f9aa2 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetVisitorTokenDataClaim

func GetVisitorTokenDataClaim(id int64, name string) *jwt.MapClaims

GetVisitorTokenDataClaim returns a jwt.MapClaims type for the "data" section of a token.

func Middleware

func Middleware(next http.Handler) http.Handler

Middleware adds a Visitor struct to Request

Types

type Visitor

type Visitor struct {
	ID   int64  `json:"id,omitempty"`
	Name string `json:"name,omitempty"`
}

Visitor contains visitor details

func GetVisitor

func GetVisitor(r *http.Request) *Visitor

GetVisitor returns visitor details from cookie

func GetVisitorFromCookie

func GetVisitorFromCookie(cookie *http.Cookie) *Visitor

GetVisitorFromCookie returns a Visitor struct after parsing the session cookie.

Jump to

Keyboard shortcuts

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