user

package
v0.33.17 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2023 License: AGPL-3.0, AGPL-3.0-only Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Fields added in v0.30.3

type Fields struct {
	Site      string
	Location  string
	Bio       string
	BlockList []model.UserID
	Privacy   PrivacySettings
	UID       model.UserID
}

type FriendItem added in v0.30.3

type FriendItem struct{}

type GroupID added in v0.30.3

type GroupID = uint8

type PrivacySettings added in v0.30.3

type PrivacySettings struct {
	ReceivePrivateMessage      ReceiveFilter
	ReceiveTimelineReply       ReceiveFilter
	ReceiveMentionNotification ReceiveFilter
	ReceiveCommentNotification ReceiveFilter
}

func (*PrivacySettings) Unmarshal added in v0.30.3

func (settings *PrivacySettings) Unmarshal(s []byte)

type PrivacySettingsField added in v0.30.3

type PrivacySettingsField int
const (
	PrivacyReceivePrivateMessage      PrivacySettingsField = 1
	PrivacyReceiveTimelineReply       PrivacySettingsField = 30
	PrivacyReceiveMentionNotification PrivacySettingsField = 20
	PrivacyReceiveCommentNotification PrivacySettingsField = 21
)

type ReceiveFilter added in v0.30.3

type ReceiveFilter uint8
const (
	ReceiveFilterAll ReceiveFilter = iota
	ReceiveFilterFriends
	ReceiveFilterNone
)

type Repo added in v0.30.3

type Repo interface {
	// GetByID find a user by uid.
	GetByID(ctx context.Context, userID model.UserID) (User, error)
	// GetByName find a user by username.
	GetByName(ctx context.Context, username string) (User, error)

	GetByIDs(ctx context.Context, ids []model.UserID) (map[model.UserID]User, error)

	GetFriends(ctx context.Context, userID model.UserID) (map[model.UserID]FriendItem, error)

	CheckIsFriendToOthers(ctx context.Context, selfID model.UserID, otherIDs ...model.UserID) (bool, error)

	GetFieldsByIDs(ctx context.Context, ids []model.UserID) (map[model.UserID]Fields, error)
}

func NewMysqlRepo added in v0.30.16

func NewMysqlRepo(q *query.Query, log *zap.Logger) (Repo, error)

type User added in v0.30.3

type User struct {
	RegistrationTime time.Time
	NickName         string
	Avatar           string
	Sign             string
	UserName         string
	ID               model.UserID
	UserGroup        GroupID
}

User is visible for everyone.

func (User) GetID added in v0.30.3

func (u User) GetID() model.UserID

Jump to

Keyboard shortcuts

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