repository

package
v0.0.0-...-98550de Latest Latest
Warning

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

Go to latest
Published: May 31, 2022 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InMemorySessionStore

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

func NewInMemorySessionStore

func NewInMemorySessionStore() *InMemorySessionStore

func (*InMemorySessionStore) Add

func (s *InMemorySessionStore) Add(session *model.Session) error

func (*InMemorySessionStore) Delete

func (s *InMemorySessionStore) Delete(id uuid.UUID)

func (*InMemorySessionStore) Send

func (s *InMemorySessionStore) Send(id uuid.UUID, messageStream *pb.MessageStreamResponse) error

type MessageStore

type MessageStore interface {
	SendMessage(ctx context.Context, message *model.Message) error
	ListMessages(ctx context.Context, id uuid.UUID, createdAt time.Time, pageSize int) ([]model.Message, error)
	ListMessagesFirst(ctx context.Context, id uuid.UUID, pageSize int) ([]model.Message, error)
}

type PostgresMessageStore

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

func NewPostgresMessageStore

func NewPostgresMessageStore(db *sqlx.DB) *PostgresMessageStore

func (*PostgresMessageStore) ListMessages

func (s *PostgresMessageStore) ListMessages(ctx context.Context, chatId uuid.UUID, createdAt time.Time, pageSize int) ([]model.Message, error)

func (*PostgresMessageStore) ListMessagesFirst

func (s *PostgresMessageStore) ListMessagesFirst(ctx context.Context, chatId uuid.UUID, pageSize int) ([]model.Message, error)

func (*PostgresMessageStore) SendMessage

func (s *PostgresMessageStore) SendMessage(ctx context.Context, message *model.Message) error

type PostgresRoomStore

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

func NewPostgresRoomStore

func NewPostgresRoomStore(db *sqlx.DB) *PostgresRoomStore

func (*PostgresRoomStore) Add

func (s *PostgresRoomStore) Add(ctx context.Context, room *model.Room) error

func (*PostgresRoomStore) AddAndSendMessage

func (s *PostgresRoomStore) AddAndSendMessage(ctx context.Context, room *model.Room, message *model.Message) (*model.Room, error)

func (*PostgresRoomStore) FindByIds

func (s *PostgresRoomStore) FindByIds(ctx context.Context, ids ...uuid.UUID) ([]model.User, error)

func (*PostgresRoomStore) FindDialogRoom

func (s *PostgresRoomStore) FindDialogRoom(ctx context.Context, userId1, userId2 uuid.UUID) (*model.Room, error)

func (*PostgresRoomStore) Get

func (s *PostgresRoomStore) Get(ctx context.Context, id uuid.UUID) (*model.Room, error)

func (*PostgresRoomStore) ListRooms

func (s *PostgresRoomStore) ListRooms(ctx context.Context, userId uuid.UUID, lastMessageDate time.Time, pageSize int) ([]model.Room, error)

func (*PostgresRoomStore) ListRoomsFirst

func (s *PostgresRoomStore) ListRoomsFirst(ctx context.Context, userId uuid.UUID, pageSize int) ([]model.Room, error)

func (*PostgresRoomStore) UsersInRoom

func (s *PostgresRoomStore) UsersInRoom(ctx context.Context, id uuid.UUID) ([]uuid.UUID, error)

type PostgresUserStore

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

func NewPostgresUserStore

func NewPostgresUserStore(db *sqlx.DB) *PostgresUserStore

func (*PostgresUserStore) Find

func (s *PostgresUserStore) Find(ctx context.Context, id uuid.UUID) (*model.User, error)

func (*PostgresUserStore) FindByUsername

func (s *PostgresUserStore) FindByUsername(ctx context.Context, username string) (*model.User, error)

func (*PostgresUserStore) Save

func (s *PostgresUserStore) Save(ctx context.Context, user *model.User) error

type RefreshTokenPostgresStore

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

func NewRefreshTokenPostgresStore

func NewRefreshTokenPostgresStore(db *sqlx.DB) *RefreshTokenPostgresStore

func (*RefreshTokenPostgresStore) Add

func (*RefreshTokenPostgresStore) Delete

func (s *RefreshTokenPostgresStore) Delete(ctx context.Context, token uuid.UUID) error

func (*RefreshTokenPostgresStore) Get

type RefreshTokenStore

type RefreshTokenStore interface {
	Add(ctx context.Context, token *model.RefreshToken) error
	Delete(ctx context.Context, token uuid.UUID) error
	Get(ctx context.Context, token uuid.UUID) (*model.RefreshToken, error)
}

type RoomStore

type RoomStore interface {
	AddAndSendMessage(ctx context.Context, room *model.Room, message *model.Message) (*model.Room, error)
	Add(ctx context.Context, room *model.Room) error
	Get(ctx context.Context, id uuid.UUID) (*model.Room, error)
	FindDialogRoom(ctx context.Context, userId1, userId2 uuid.UUID) (*model.Room, error)
	UsersInRoom(ctx context.Context, id uuid.UUID) ([]uuid.UUID, error)
	FindByIds(ctx context.Context, ids ...uuid.UUID) ([]model.User, error)
	ListRooms(ctx context.Context, userId uuid.UUID, lastMessageDate time.Time, pageSize int) ([]model.Room, error)
	ListRoomsFirst(ctx context.Context, userId uuid.UUID, pageSize int) ([]model.Room, error)
}

type SessionStore

type SessionStore interface {
	Add(session *model.Session) error
	Send(id uuid.UUID, messageStream *pb.MessageStreamResponse) error
	Delete(id uuid.UUID)
}

type UserStore

type UserStore interface {
	Save(ctx context.Context, user *model.User) error
	Find(ctx context.Context, id uuid.UUID) (*model.User, error)
	FindByUsername(ctx context.Context, username string) (*model.User, error)
}

Jump to

Keyboard shortcuts

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