session

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2022 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" json:"login"`
	Username string `json:"username"`
	Password string `json:"-"`
}

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(cid uint64) []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