model

package
v0.0.0-...-514e0f0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuditEvent

type AuditEvent struct {
	ID        int64  `db:"id"`
	UserID    int64  `db:"user_id"`
	Message   string `db:"msg"`
	Timestamp string `db:"occurred_at"`
}

type User

type User struct {
	ID       int64  `db:"id"`
	Username string `db:"username"`
	Email    string `db:"email"`
	Rank     int    `db:"rank"`
	Banned   bool   `db:"banned"`
}

type UserModel

type UserModel struct {
	Conn *sqlx.DB
}

func NewUserModel

func NewUserModel(db *sqlx.DB) (*UserModel, error)

func (*UserModel) AddNewAuditEvent

func (m *UserModel) AddNewAuditEvent(userID int64, message string) error

func (*UserModel) BanUser

func (m *UserModel) BanUser(uid int64) error

func (*UserModel) GetAuditEvents

func (m *UserModel) GetAuditEvents(userID, page int64) ([]AuditEvent, int64, error)

func (*UserModel) GetForeignUser

func (m *UserModel) GetForeignUser(foreignUserID string, foreignWebsite string) (int64, error)

Maybe I should cut down on the copy pasta

func (*UserModel) GetPassHash

func (m *UserModel) GetPassHash(uid int64) (string, error)

func (*UserModel) GetUserIDsForUsername

func (m *UserModel) GetUserIDsForUsername(username string) ([]int64, error)

func (*UserModel) GetUserWithID

func (m *UserModel) GetUserWithID(userID int64) (*User, error)

func (*UserModel) GetUserWithUsername

func (m *UserModel) GetUserWithUsername(username string) (int64, error)

func (*UserModel) IsBanned

func (m *UserModel) IsBanned(uid int64) (bool, error)

func (*UserModel) NewUser

func (m *UserModel) NewUser(username, email string, passHash []byte, foreignUser bool, foreignUserID, foreignWebsite string) (int64, error)

Password in this context is in plaintext

func (*UserModel) SetNewHash

func (m *UserModel) SetNewHash(uid int64, hash []byte) error

func (*UserModel) SetUserRank

func (m *UserModel) SetUserRank(uid, rank int64) error

type Username

type Username struct {
	ID       int64  `db:"id"`
	Username string `db:"username"`
	Email    string `db:"email"`
	Rank     int    `db:"rank"`
}

Jump to

Keyboard shortcuts

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