sessionapi

package
v0.0.0-...-9714d35 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2023 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Api

type Api struct {
	*SessionCache
}

receiver type

func (*Api) Attached

func (sc *Api) Attached(method string) bool

implement the Cruder interface

func (*Api) Create

func (sc *Api) Create(w http.ResponseWriter, r *http.Request, _ httprouter.Params)

func (*Api) Delete

func (sc *Api) Delete(w http.ResponseWriter, r *http.Request, ps httprouter.Params)

func (*Api) List

func (sc *Api) List(w http.ResponseWriter, r *http.Request, _ httprouter.Params)

func (*Api) Read

func (sc *Api) Read(w http.ResponseWriter, r *http.Request, ps httprouter.Params)

func (*Api) Replace

func (sc *Api) Replace(w http.ResponseWriter, r *http.Request, ps httprouter.Params)

func (*Api) Update

func (sc *Api) Update(w http.ResponseWriter, r *http.Request, ps httprouter.Params)

type SessionCache

type SessionCache struct {
	// contains filtered or unexported fields
}

receiver type

func NewSessionCache

func NewSessionCache(db *sql.DB, users *userapi.UserCache) *SessionCache

generator

func (*SessionCache) Auth

func (sc *SessionCache) Auth(r *http.Request) (ok bool)

user session exists

func (*SessionCache) GetSession

func (sc *SessionCache) GetSession(sessionId string) *UserSession

func (*SessionCache) Insert

func (sc *SessionCache) Insert(s *UserSession)

type UserSession

type UserSession struct {
	Id           string `json:"id" bson:"_id"`
	Username     string `json:"-"`
	LoginTime    time.Time
	LastseenTime time.Time `json:"-" bson:"-"`
}

Jump to

Keyboard shortcuts

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