sessionmodel

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2020 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Model

type Model struct {
	SessionID string `` /* 130-byte string literal not displayed */
	Userid    string `model:"userid,VARCHAR(31) NOT NULL;index" query:"userid,deleq,userid"`
	KeyHash   string `model:"keyhash,VARCHAR(127) NOT NULL" query:"keyhash"`
	Time      int64  `model:"time,BIGINT NOT NULL" query:"time,getgroupeq,userid"`
	IPAddr    string `model:"ipaddr,VARCHAR(63)" query:"ipaddr"`
	UserAgent string `model:"user_agent,VARCHAR(1023)" query:"user_agent"`
}

Model is the db User session model

type Repo

type Repo interface {
	New(userid, ipaddr, useragent string) (*Model, string, error)
	ValidateKey(key string, m *Model) (bool, error)
	RehashKey(m *Model) (string, error)
	GetByID(sessionid string) (*Model, error)
	GetUserSessions(userid string, limit, offset int) ([]Model, error)
	GetUserSessionIDs(userid string, limit, offset int) ([]string, error)
	Insert(m *Model) error
	Update(m *Model) error
	Delete(m *Model) error
	DeleteSessions(sessionids []string) error
	DeleteUserSessions(userid string) error
	Setup() error
}

func New

func New(database db.Database) Repo

New creates a new user session repository

Jump to

Keyboard shortcuts

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