database

package
v0.0.0-...-bcd9d07 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Character

type Character struct {
	ID    int    `db:"id"`
	Notes string `db:"notes"`
}

type DB

type DB struct {
	*sqlx.DB
}

func New

func New(dsn string, automigrate bool) (*DB, error)

func (*DB) DeletePasswordResets

func (db *DB) DeletePasswordResets(userID int) error

func (*DB) GetCharacter

func (db *DB) GetCharacter(id int) (*Character, error)

func (*DB) GetPasswordReset

func (db *DB) GetPasswordReset(hashedToken string) (*PasswordReset, error)

func (*DB) GetSession

func (db *DB) GetSession(key string) (*DjangoSession, error)

func (*DB) GetUser

func (db *DB) GetUser(id int) (*User, error)

func (*DB) GetUserByEmail

func (db *DB) GetUserByEmail(email string) (*User, error)

func (*DB) InsertPasswordReset

func (db *DB) InsertPasswordReset(hashedToken string, userID int, ttl time.Duration) error

func (*DB) InsertUser

func (db *DB) InsertUser(email, hashedPassword string) (int, error)

func (*DB) SetCharacterNotes

func (db *DB) SetCharacterNotes(id int, notes string) error

func (*DB) UpdateUserHashedPassword

func (db *DB) UpdateUserHashedPassword(id int, hashedPassword string) error

type DjangoSession

type DjangoSession struct {
	SessionKey  string    `db:"session_key"`
	SessionData string    `db:"session_data"`
	ExpireData  time.Time `db:"expire_date"`
}

func (*DjangoSession) Decode

func (s *DjangoSession) Decode() (*DjangoSessionData, error)

type DjangoSessionData

type DjangoSessionData struct {
	Preview         bool   `json:"preview"`
	AuthUserID      string `json:"_auth_user_id"`
	AuthUserBackend string `json:"_auth_user_backend"`
	AuthUserHash    string `json:"_auth_user_hash"`
}

type PasswordReset

type PasswordReset struct {
	HashedToken string    `db:"hashed_token"`
	UserID      int       `db:"user_id"`
	Expiry      time.Time `db:"expiry"`
}

type User

type User struct {
	ID             int       `db:"id"`
	Created        time.Time `db:"date_joined"`
	Email          string    `db:"email"`
	HashedPassword string    `db:"password"`
}

Jump to

Keyboard shortcuts

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