modules

package
v0.0.0-...-431252f Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2022 License: BSL-1.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 Admin

type Admin struct {
	Conn *gorm.DB
}

func (Admin) Grant

func (db Admin) Grant(identifier string) error

Grant sets User.Level to 1 ONLY SUPER ADMIN

func (Admin) Remove

func (db Admin) Remove(identifier string) error

Remove sets User.Level to 0 ONLY SUPER ADMIN

type Login

type Login struct {
	Conn *gorm.DB
}

func (Login) GetUserByID

func (db Login) GetUserByID(id int) (*model.Users, error)

GetUserByID returns user struct by id

func (Login) MailExist

func (db Login) MailExist(email string) (*model.Users, error)

MailExist returns user struct or nil if not exists

type Register

type Register struct {
	Conn *gorm.DB
}

func (Register) NewUser

func (db Register) NewUser(user model.Users) error

NewUser creates new user in table

type ReportTemplate

type ReportTemplate struct {
	model.Reports
	Created     string
	Checked     string
	User, Admin string
}

type ReportWithMail

type ReportWithMail struct {
	Email   string
	Created string
	model.Reports
}

type Reports

type Reports struct {
	Conn *gorm.DB
}

func (Reports) Check

func (db Reports) Check(reportID, adminID int, answer string) error

Check set answer for report

func (Reports) DeleteByID

func (db Reports) DeleteByID(id int) error

DeleteByID deletes report by report_id value

func (Reports) Get

func (db Reports) Get(id int) (*ReportTemplate, error)

Get returns report with mails and dates

func (Reports) GetReports

func (db Reports) GetReports(offset, limit int, checked bool) ([]ReportWithMail, error)

GetReports returns slice with reports, nil if not exists offset: offset relative to query; limit: how much return (max 100)

func (Reports) New

func (db Reports) New(report *model.Reports) error

New creates report from struct

type Reset

type Reset struct {
	Conn *gorm.DB
}

func (Reset) UpdatePass

func (db Reset) UpdatePass(id int, pass string) error

UpdatePass sets new password for user id

type Session

type Session struct {
	Conn *gorm.DB
}

func (Session) Clear

func (db Session) Clear(days int) error

Clear deletes old sessions using DATEDIFF

func (Session) DeleteByKey

func (db Session) DeleteByKey(key string) error

DeleteByKey deletes sessions by uuid key

func (Session) DeleteByUserID

func (db Session) DeleteByUserID(id int) error

DeleteByUserID deletes session by user_id value

func (Session) Insert

func (db Session) Insert(userid int, key string) error

Insert creates new session

func (Session) Verify

func (db Session) Verify(key string) (int, error)

Verify key: UUID from cookie, int: user_id

Jump to

Keyboard shortcuts

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