session

package
v0.0.20 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const Dtime = 3600

Variables

View Source
var Sessions sync.Map

Functions

func DeleteSession

func DeleteSession(hash string)

func HashPassword

func HashPassword(text string) string

func UserCreate

func UserCreate(usr User)

func UserModify

func UserModify(usr User)

func UserRm

func UserRm(id uint64)

Types

type Session

type Session struct {
	User
	Hash  string `json:"hash"`
	Dtime int64  `json:"dtime"`
}

func CreateFullSession

func CreateFullSession(sess *Session, ignoreFile bool) *Session

func CreateSession

func CreateSession(sess *Session) *Session

func GetSession

func GetSession(hash string) *Session

func (*Session) Set

func (s *Session) Set(user User)

type User

type User struct {
	Id        uint64 `gorm:"primarykey" json:"id"`
	Access    uint   `json:"access"`
	Login     string `gorm:"index:usr_login" json:"login"`
	Username  string `json:"username"`
	Password  string `json:"-"`
	Attribute string `gorm:"index:usr_attr" json:"attribute"`
}

func GetUserAttribute added in v0.0.19

func GetUserAttribute(attr string) User

func GetUserById

func GetUserById(id uint64) User

func GetUserByLoginAndPassword

func GetUserByLoginAndPassword(login string, pass string) User

func GetUserLogin

func GetUserLogin(login string) User

func GetUsers

func GetUsers() []User

func (User) TableName

func (u User) TableName() string

Jump to

Keyboard shortcuts

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