storage

package
v0.0.0-...-4899dfc Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDuplicateKey = errors.New("duplicate key value violates unique constraint")
)

Functions

This section is empty.

Types

type Role

type Role int
const (
	RoleGuest Role = iota
	RoleUser
	RoleAdmin
)

type Session

type Session struct {
	ID uint64 `db:"id"`

	UserID uint64 `db:"user_id"`
	User   User   `db:"user"`

	Token     string     `db:"token"`
	ExpiresAt *time.Time `db:"expires_at"`
}

type SessionsStorage

type SessionsStorage struct {
	// contains filtered or unexported fields
}

func NewSessions

func NewSessions(db *sqlx.DB) SessionsStorage

func (SessionsStorage) Create

func (s SessionsStorage) Create(session *Session) error

func (SessionsStorage) GetJoinedUsersByToken

func (s SessionsStorage) GetJoinedUsersByToken(token string) (*Session, error)

type User

type User struct {
	ID       uint64 `db:"id"`
	Email    string `db:"email"`
	Password []byte `db:"password"`
	Role     Role   `db:"role"`
}

type UsersStorage

type UsersStorage struct {
	// contains filtered or unexported fields
}

func NewUsers

func NewUsers(db *sqlx.DB) UsersStorage

func (UsersStorage) Create

func (s UsersStorage) Create(user *User) error

func (UsersStorage) GetByEmail

func (s UsersStorage) GetByEmail(email string) (*User, error)

Jump to

Keyboard shortcuts

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