userstore

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2022 License: LGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VisitorID   = uint64(1)
	VisitorName = "visitor"
)

Variables

View Source
var (
	ErrReachedLimit     = errors.New("reached space limit")
	ErrUserNotFound     = errors.New("user not found")
	ErrNegtiveUsedSpace = errors.New("used space can not be negative")
)

Functions

This section is empty.

Types

type IUserStore

type IUserStore interface {
	Init(rootName, rootPwd string) error
	IsInited() bool
	AddUser(user *db.User) error
	DelUser(id uint64) error
	GetUser(id uint64) (*db.User, error)
	GetUserByName(name string) (*db.User, error)
	SetInfo(id uint64, user *db.User) error
	SetUsed(id uint64, incr bool, capacity int64) error
	ResetUsed(id uint64, used int64) error
	SetPwd(id uint64, pwd string) error
	SetPreferences(id uint64, settings *db.Preferences) error
	ListUsers() ([]*db.User, error)
	ListUserIDs() (map[string]string, error)
	AddRole(role string) error
	DelRole(role string) error
	ListRoles() (map[string]bool, error)
}

type KVUserStore

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

func NewKVUserStore

func NewKVUserStore(store kvstore.IKVStore) (*KVUserStore, error)

func (*KVUserStore) AddRole

func (us *KVUserStore) AddRole(role string) error

func (*KVUserStore) AddUser

func (us *KVUserStore) AddUser(user *db.User) error

func (*KVUserStore) DelRole

func (us *KVUserStore) DelRole(role string) error

func (*KVUserStore) DelUser

func (us *KVUserStore) DelUser(id uint64) error

func (*KVUserStore) GetUser

func (us *KVUserStore) GetUser(id uint64) (*db.User, error)

func (*KVUserStore) GetUserByName

func (us *KVUserStore) GetUserByName(name string) (*db.User, error)

func (*KVUserStore) Init

func (us *KVUserStore) Init(rootName, rootPwd string) error

func (*KVUserStore) IsInited

func (us *KVUserStore) IsInited() bool

func (*KVUserStore) ListRoles

func (us *KVUserStore) ListRoles() (map[string]bool, error)

func (*KVUserStore) ListUserIDs added in v0.5.2

func (us *KVUserStore) ListUserIDs() (map[string]string, error)

func (*KVUserStore) ListUsers

func (us *KVUserStore) ListUsers() ([]*db.User, error)

func (*KVUserStore) ResetUsed added in v0.6.1

func (us *KVUserStore) ResetUsed(id uint64, used int64) error

func (*KVUserStore) SetInfo

func (us *KVUserStore) SetInfo(id uint64, user *db.User) error

func (*KVUserStore) SetPreferences added in v0.4.13

func (us *KVUserStore) SetPreferences(id uint64, prefers *db.Preferences) error

func (*KVUserStore) SetPwd

func (us *KVUserStore) SetPwd(id uint64, pwd string) error

func (*KVUserStore) SetUsed

func (us *KVUserStore) SetUsed(id uint64, incr bool, capacity int64) error

Jump to

Keyboard shortcuts

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