user

package
v0.1.26 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ByAsc added in v0.1.1

type ByAsc []IOrderUser

func (ByAsc) Len added in v0.1.1

func (a ByAsc) Len() int

func (ByAsc) Less added in v0.1.1

func (a ByAsc) Less(i, j int) bool

func (ByAsc) Swap added in v0.1.1

func (a ByAsc) Swap(i, j int)

type Group

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

func NewGroup

func NewGroup(user IUser) *Group

type GroupUser added in v0.1.3

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

func NewGroupUser added in v0.1.3

func NewGroupUser() *GroupUser

func (*GroupUser) AddUser added in v0.1.3

func (groupUser *GroupUser) AddUser(user ...string)

func (*GroupUser) GetRawUser added in v0.1.3

func (groupUser *GroupUser) GetRawUser() map[string]any

type History added in v0.1.16

type History struct {
	Username     string
	OnlineTime   *time.Time
	OfflineTime  *time.Time
	LastLiveTime *time.Time
	LastMessage  []*TextMessage
	// contains filtered or unexported fields
}

type HistoryMessage added in v0.1.16

type HistoryMessage struct {
	Username     string
	OnlineTime   string
	OfflineTime  string
	LastLiveTime string
	LastMessage  []*TextMessageMessage
}

type HistoryStore added in v0.0.6

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

func NewHistoryStore added in v0.0.6

func NewHistoryStore() *HistoryStore

func (*HistoryStore) FlashLiveTime added in v0.1.16

func (h *HistoryStore) FlashLiveTime(user IUser)

func (*HistoryStore) RecordMessage added in v0.1.16

func (h *HistoryStore) RecordMessage(msg message.IMessage)

type IOrderUser added in v0.1.1

type IOrderUser interface {
	// WriteMessage 异步,代码里面不能阻塞
	WriteMessage(iMessage message.IMessage, writeFunc WriteCallBackFunc)
	GetPriority() int
	GetMachineId() string
	GetOrderTime() *time.Time
}

type IUser

type IUser interface {
	IOrderUser
	GetId() string
	Close()
	GetUsername() string
	GetGroupIds() []string
	GetRemoteAddress() string
	SetUsername(username string)
	LastLiveTime() *time.Time
	CreateTime() *time.Time
}

type Store

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

func NewStore

func NewStore() *Store

func (*Store) AddUser

func (store *Store) AddUser(user IUser) bool

func (*Store) DeleteUser

func (store *Store) DeleteUser(user IUser) bool

func (*Store) FlashLiveTime added in v0.1.16

func (store *Store) FlashLiveTime(user IUser)

func (*Store) GetHistory added in v0.0.6

func (store *Store) GetHistory(username string) (*HistoryMessage, bool)

func (*Store) GetOrderUser added in v0.1.1

func (store *Store) GetOrderUser(username string) ([]IOrderUser, bool)

func (*Store) GetUser

func (store *Store) GetUser(username string) ([]IUser, bool)

func (*Store) GetUserNum

func (store *Store) GetUserNum() int

func (*Store) QueryGroupsUser added in v0.1.3

func (store *Store) QueryGroupsUser(groupIds ...string) *GroupUser

func (*Store) Range

func (store *Store) Range(f func(username string, user *StoreUser) bool)

func (*Store) RangeGroupUser

func (store *Store) RangeGroupUser(groupId string, f func(username string) bool)

func (*Store) RecordMessage added in v0.1.16

func (store *Store) RecordMessage(msg message.IMessage)

func (*Store) UserHasConn

func (store *Store) UserHasConn() bool

type StoreGroup

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

func NewStoreGroup

func NewStoreGroup() *StoreGroup

func (*StoreGroup) AddUser

func (storeGroup *StoreGroup) AddUser(user IUser)

func (*StoreGroup) RangeUser

func (storeGroup *StoreGroup) RangeUser(f func(string) bool)

func (*StoreGroup) RemoteUser

func (storeGroup *StoreGroup) RemoteUser(user IUser)

type StoreUser

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

func (*StoreUser) GetCreateTime

func (u *StoreUser) GetCreateTime() string

func (*StoreUser) GetGroupIds

func (u *StoreUser) GetGroupIds() []string

func (*StoreUser) IsInGroup

func (u *StoreUser) IsInGroup(group string) bool

type TextMessage added in v0.1.16

type TextMessage struct {
	From string
	Msg  string
	Time *time.Time
}

type TextMessageMessage added in v0.1.16

type TextMessageMessage struct {
	From string
	Msg  string
	Time string
}

type WriteCallBackFunc

type WriteCallBackFunc func(err error, hasUser bool)

Jump to

Keyboard shortcuts

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