users

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrProgressEntryNotExist = errors.New("entry does not exist")

Functions

This section is empty.

Types

type CatalogProgress

type CatalogProgress struct {
	Data map[string]*SeriesProgress
}

func NewCatalogProgress

func NewCatalogProgress() *CatalogProgress

func UnmarshalCatalogProgress

func UnmarshalCatalogProgress(data []byte) *CatalogProgress

func (*CatalogProgress) AddSeries

func (p *CatalogProgress) AddSeries(sid string, entries int)

func (*CatalogProgress) DeleteSeries

func (p *CatalogProgress) DeleteSeries(sid string)

func (*CatalogProgress) GetSeries

func (p *CatalogProgress) GetSeries(sid string) *SeriesProgress

type EntryProgress

type EntryProgress struct {
	Current int `json:"current"`
	Total   int `json:"total"`
}

func NewEntryProgress

func NewEntryProgress(total int) *EntryProgress

func (*EntryProgress) Percent

func (rp *EntryProgress) Percent() float64

func (*EntryProgress) Set

func (rp *EntryProgress) Set(n int)

func (*EntryProgress) SetRead

func (rp *EntryProgress) SetRead()

func (*EntryProgress) SetUnread

func (rp *EntryProgress) SetUnread()

func (*EntryProgress) String

func (rp *EntryProgress) String() string

type SeriesProgress

type SeriesProgress struct {
	Entries []*EntryProgress `json:"tracker"`
	M       sync.RWMutex     `json:"mutex"`
}

func NewSeriesProgress

func NewSeriesProgress(entries int) *SeriesProgress

func (*SeriesProgress) DeleteEntry

func (p *SeriesProgress) DeleteEntry(i int)

func (*SeriesProgress) GetEntryProgress

func (p *SeriesProgress) GetEntryProgress(i int) *EntryProgress

func (*SeriesProgress) SetAllRead

func (p *SeriesProgress) SetAllRead()

func (*SeriesProgress) SetAllUnread

func (p *SeriesProgress) SetAllUnread()

func (*SeriesProgress) SetEntryProgress

func (p *SeriesProgress) SetEntryProgress(i int, e *EntryProgress) error

type Type

type Type string
const (
	Admin    Type = "admin"
	Standard Type = "standard"
)

func UnmarshalType

func UnmarshalType(data []byte) Type

type User

type User struct {
	Hash     string           `json:"hash"`
	Name     string           `json:"name"`
	Pass     string           `json:"pass"`
	Type     Type             `json:"type"`
	Progress *CatalogProgress `json:"progress"`
}

func NewUser

func NewUser(name, pass string, t Type) *User

NewUser expects username and unhashed password along with the users permission

Jump to

Keyboard shortcuts

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