users

package
v0.0.0-...-b289748 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2024 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Users

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

func NewUsers

func NewUsers(ua UsersArgs) *Users

func (*Users) Create

func (u *Users) Create(user *t.User) error

UserCreate creates a new user. Returns error and true if error

is due to duplicate user name, false for any other error

func (*Users) Delete

func (u *Users) Delete(uid t.Uid, hard bool) error

UserDelete deletes specified user: wipes completely (hard-delete) or marks as deleted. TODO: report when the user is not found.

func (*Users) Get

func (u *Users) Get(uid t.Uid) (*t.User, error)

Get fetches a single user by user id. If user is not found it returns (nil, nil)

func (*Users) GetAll

func (u *Users) GetAll(ids ...t.Uid) ([]t.User, error)

UserGetAll returns user records for a given list of user IDs

func (*Users) GetByCred

func (u *Users) GetByCred(method, value string) (t.Uid, error)

GetByCred returns user ID for the given validated credential.

func (*Users) GetUnvalidated

func (u *Users) GetUnvalidated(lastUpdatedBefore time.Time, limit int) ([]t.Uid, error)

GetUnvalidated returns a list of uids which have never logged in, have no

validated credentials and haven't been updated since lastUpdatedBefore.

func (*Users) UnreadCount

func (u *Users) UnreadCount(ids ...types.Uid) (map[t.Uid]int, error)

UnreadCount returns the total number of unread messages in all topics with

the R permission. If read fails, the counts are still returned with the original

user IDs but with the unread count undefined and non-nil error.

func (*Users) Update

func (u *Users) Update(uid types.Uid, update map[string]any) error

Update updates user object.

func (*Users) UpdateTags

func (u *Users) UpdateTags(uid types.Uid, add, remove, reset []string) ([]string, error)

UpdateTags adds or resets user's tags

type UsersArgs

type UsersArgs struct {
	DB     *pgxpool.Pool
	Utils  *utils.Utils
	Cfg    *config.StorePostgresConfig
	Shared *shared.Shared
	UGen   *types.UidGenerator
}

Jump to

Keyboard shortcuts

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