model

package
v0.0.0-...-86240e4 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2023 License: BSD-2-Clause 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"`
	Gender    string  `db:"gender"`
	Bio       string  `db:"bio"`
	Birthdate *string `db:"birthdate"`
	JoinDate  string  `db:"join_date"`
}

type UserModel

type UserModel struct {
	Conn *sqlx.DB
}

func NewUserModel

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

func (*UserModel) AddFollower

func (m *UserModel) AddFollower(following, followed int64) 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) GetFollowers

func (m *UserModel) GetFollowers(userID int64) ([]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

func (*UserModel) UpdateProfile

func (m *UserModel) UpdateProfile(bio, birthdate, gender, username string, userID 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