manager

package
v0.0.0-...-f70499c Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Channel

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

func NewChannelManager

func NewChannelManager(channelBackend ChannelBackend) Channel

func (Channel) AddMember

func (m Channel) AddMember(channel model.Channel, user model.User, role model.ChannelRole) error

func (Channel) Create

func (m Channel) Create(name string, user model.User) (model.Channel, error)

func (Channel) FindByUUID

func (m Channel) FindByUUID(channelUUID string) (model.Channel, error)

func (Channel) GetChannelForUser

func (m Channel) GetChannelForUser(channelUUID, userUUID string) (model.Channel, error)

func (Channel) GetChannelListForUser

func (m Channel) GetChannelListForUser(userUUID string) ([]model.Channel, error)

func (Channel) GetMemberInfo

func (m Channel) GetMemberInfo(channelUUID, userUUID string) (model.Member, error)

type ChannelBackend

type ChannelBackend interface {
	Create(channel model.Channel) error
	FindByUUID(uuid string) (model.Channel, error)
	FindAllForUser(userUUID string) ([]model.Channel, error)
	FindForUser(channelUUID, userUUID string) (model.Channel, error)
	AddMember(channel model.Channel, user model.User, role model.ChannelRole) error
	FindMember(channelUUID string, userUUID string) (model.Member, error)
}

type Credential

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

func NewCredentialManager

func NewCredentialManager(verificationBackend CredentialBackend) Credential

func (Credential) CheckPasswordForUser

func (m Credential) CheckPasswordForUser(userUUID, plainPassword string) (isValid bool, err error)

func (Credential) SetPasswordForUser

func (m Credential) SetPasswordForUser(userUUID, plainPassword string) error

type CredentialBackend

type CredentialBackend interface {
	SetPassword(userUUID, hashedPassword string) error
	FindPasswordByUserUUID(userUUID string) (model.PasswordCredential, error)
}

type Message

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

func NewMessageManager

func NewMessageManager(messageBackend MessageBackend) Message

func (Message) FindLastMessageForChannels

func (m Message) FindLastMessageForChannels(channelUUIDs ...string) ([]model.Message, error)

func (Message) FindMessagesForChannel

func (m Message) FindMessagesForChannel(channelUUID string) ([]model.Message, error)

func (Message) Send

func (m Message) Send(channel model.Channel, message model.Message) (model.Message, error)

type MessageBackend

type MessageBackend interface {
	Create(channelUUID string, message model.Message) error
	FindForChannel(channelUUID string, limit, offset int32) ([]model.Message, error)
	FindLastMessageForChannels(channelUUIDs ...string) ([]model.Message, error)
}

type Session

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

func NewSessionManager

func NewSessionManager(sessionBackend SessionBackend) Session

func (Session) CreateSession

func (m Session) CreateSession(userUUID string) (model.Session, error)

func (Session) Delete

func (m Session) Delete(id string) error

func (Session) FindByID

func (m Session) FindByID(id string) (model.Session, error)

func (Session) FindByIdAndMarkSeen

func (m Session) FindByIdAndMarkSeen(id string) (model.Session, error)

func (Session) SetLastSeenAt

func (m Session) SetLastSeenAt(id string, lastSeenAt time.Time) error

type SessionBackend

type SessionBackend interface {
	Create(model model.Session) error
	FindByID(id string) (model.Session, error)
	SetLastSeenAt(id string, lastSeenAt time.Time) error
	Delete(id string) error
}

type User

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

func NewUserManager

func NewUserManager(userBackend UserBackend, credentialBackend CredentialBackend) User

func (User) Create

func (m User) Create(user model.User) error

func (User) FindAllByUUIDs

func (m User) FindAllByUUIDs(userUUIDs ...string) (map[string]model.User, error)

func (User) FindByEmail

func (m User) FindByEmail(email string) (model.User, error)

func (User) FindByEmailAndPlainPassword

func (m User) FindByEmailAndPlainPassword(email, plainPassword string) (user model.User, err error)

func (User) FindByUUID

func (m User) FindByUUID(uuid string) (model.User, error)

type UserBackend

type UserBackend interface {
	Create(model.User) error
	FindByUUID(uuid string) (model.User, error)
	FindByEmail(email string) (model.User, error)
	FindAllByUUIDs(userUUIDs ...string) (map[string]model.User, error)
	SetEmail(uuid, email string, emailVerifiedAt time.Time) error
}

type Verification

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

func NewVerificationManager

func NewVerificationManager(verificationBackend VerificationBackend) Verification

func (Verification) CreateAndSendCode

func (m Verification) CreateAndSendCode(userUUID *string, fieldName string, fieldValue string) (model.FieldVerification, error)

func (Verification) FindByUUID

func (m Verification) FindByUUID(uuid string) (model.FieldVerification, error)

type VerificationBackend

type VerificationBackend interface {
	Create(verification model.FieldVerification) error
	FindByUUID(uuid string) (model.FieldVerification, error)
}

Jump to

Keyboard shortcuts

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