Documentation ¶
Index ¶
- Constants
- func Hash(s string) string
- func Paginate(currentPage int, pageSize int) func(db *gorm.DB) *gorm.DB
- type Highlight
- type HighlightRepository
- func (u *HighlightRepository) Highlight(userID int, documentPath string) error
- func (u *HighlightRepository) Highlighted(userID int, doc index.Document) index.Document
- func (u *HighlightRepository) HighlightedPaginatedResult(userID int, results result.Paginated[[]index.Document]) result.Paginated[[]index.Document]
- func (u *HighlightRepository) Highlights(userID int, page int, resultsPerPage int) (result.Paginated[[]string], error)
- func (u *HighlightRepository) Remove(userID int, documentPath string) error
- func (u *HighlightRepository) RemoveDocument(documentPath string) error
- type Session
- type User
- type UserRepository
- func (u *UserRepository) Admins() int64
- func (u *UserRepository) Create(user *User) error
- func (u *UserRepository) Delete(uuid string) error
- func (u *UserRepository) FindByEmail(email string) (*User, error)
- func (u *UserRepository) FindByRecoveryUuid(recoveryUuid string) (*User, error)
- func (u *UserRepository) FindByUsername(username string) (*User, error)
- func (u *UserRepository) FindByUuid(uuid string) (*User, error)
- func (u *UserRepository) List(page int, resultsPerPage int) (result.Paginated[[]User], error)
- func (u *UserRepository) Total() int64
- func (u *UserRepository) Update(user *User) error
Constants ¶
View Source
const ( ResultsPerPage = 10.0 )
View Source
const ( RoleRegular = iota + 1 RoleAdmin )
User roles identifiers
View Source
const UsernamePattern = `^[A-z0-9_\-.]+$`
Variables ¶
This section is empty.
Functions ¶
Types ¶
type HighlightRepository ¶
func (*HighlightRepository) Highlight ¶
func (u *HighlightRepository) Highlight(userID int, documentPath string) error
func (*HighlightRepository) Highlighted ¶
func (*HighlightRepository) HighlightedPaginatedResult ¶
func (*HighlightRepository) Highlights ¶
func (*HighlightRepository) Remove ¶
func (u *HighlightRepository) Remove(userID int, documentPath string) error
func (*HighlightRepository) RemoveDocument ¶
func (u *HighlightRepository) RemoveDocument(documentPath string) error
type User ¶
type User struct { ID uint `gorm:"primarykey"` CreatedAt time.Time UpdatedAt time.Time Uuid string `gorm:"uniqueIndex; not null"` Name string `gorm:"not null"` Username string `gorm:"type:text collate nocase; not null; unique"` Email string `gorm:"uniqueIndex; not null"` SendToEmail string Password string Role int `gorm:"not null"` WordsPerMinute float64 RecoveryUUID string RecoveryValidUntil time.Time Highlights []Highlight `gorm:"constraint:OnDelete:CASCADE"` }
func (User) ConfirmPassword ¶
type UserRepository ¶
func (*UserRepository) Admins ¶
func (u *UserRepository) Admins() int64
func (*UserRepository) Create ¶
func (u *UserRepository) Create(user *User) error
func (*UserRepository) Delete ¶
func (u *UserRepository) Delete(uuid string) error
func (*UserRepository) FindByEmail ¶
func (u *UserRepository) FindByEmail(email string) (*User, error)
func (*UserRepository) FindByRecoveryUuid ¶
func (u *UserRepository) FindByRecoveryUuid(recoveryUuid string) (*User, error)
func (*UserRepository) FindByUsername ¶
func (u *UserRepository) FindByUsername(username string) (*User, error)
func (*UserRepository) FindByUuid ¶
func (u *UserRepository) FindByUuid(uuid string) (*User, error)
func (*UserRepository) Total ¶
func (u *UserRepository) Total() int64
func (*UserRepository) Update ¶
func (u *UserRepository) Update(user *User) error
Click to show internal directories.
Click to hide internal directories.