group

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUserNotIntGroup  = errors.New("user not in group")
	ErrUserExistInGroup = errors.New("user exist in group")
)

Functions

This section is empty.

Types

type Group

type Group interface {
	AddUser(ctx context.Context, uid string) error     // add user to group
	RemoveUser(ctx context.Context, uid string) error  // remove user from group
	RemoveUsers(ctx context.Context, uids []string)    // remove users from group
	RemoveAllUsers(ctx context.Context)                // remove all users from group
	GetUsers(ctx context.Context) []string             // get all users in group
	GetUserCount(ctx context.Context) int              // get user count in group
	GetLastRefresh(ctx context.Context) int64          // get last refresh time
	ContainsUser(ctx context.Context, uid string) bool // check if user is in group
	GetGroupName(ctx context.Context) string           // get group name
	GetGroupID(ctx context.Context) int64              // get group id
}

type GroupServer

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

func NewGroupServer

func NewGroupServer() *GroupServer

func (*GroupServer) CreateMemoryGroup

func (gs *GroupServer) CreateMemoryGroup(name string) Group

func (*GroupServer) DeleteGroup added in v0.2.2

func (gs *GroupServer) DeleteGroup(name string)

func (*GroupServer) DeleteUserByName

func (gs *GroupServer) DeleteUserByName(uid string)

func (*GroupServer) GetGroup

func (gs *GroupServer) GetGroup(name string) (Group, bool)

func (*GroupServer) ListGroup added in v0.1.3

func (gs *GroupServer) ListGroup() []Group

type MemoryGroup

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

func NewMemoryGroup

func NewMemoryGroup(name string, groupID int64) *MemoryGroup

func (*MemoryGroup) AddUser

func (group *MemoryGroup) AddUser(ctx context.Context, uid string) error

func (*MemoryGroup) ContainsUser

func (group *MemoryGroup) ContainsUser(ctx context.Context, uid string) bool

func (*MemoryGroup) GetGroupID

func (group *MemoryGroup) GetGroupID(ctx context.Context) int64

func (*MemoryGroup) GetGroupName

func (group *MemoryGroup) GetGroupName(ctx context.Context) string

func (*MemoryGroup) GetLastRefresh

func (group *MemoryGroup) GetLastRefresh(ctx context.Context) int64

func (*MemoryGroup) GetUserCount

func (group *MemoryGroup) GetUserCount(ctx context.Context) int

func (*MemoryGroup) GetUsers

func (group *MemoryGroup) GetUsers(ctx context.Context) []string

func (*MemoryGroup) RemoveAllUsers

func (group *MemoryGroup) RemoveAllUsers(ctx context.Context)

func (*MemoryGroup) RemoveUser

func (group *MemoryGroup) RemoveUser(ctx context.Context, uid string) error

func (*MemoryGroup) RemoveUsers

func (group *MemoryGroup) RemoveUsers(ctx context.Context, uids []string)

Jump to

Keyboard shortcuts

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