27 lines
901 B
Go
27 lines
901 B
Go
package domain
|
|
|
|
import "context"
|
|
|
|
type UserRepository interface {
|
|
Create(ctx context.Context, user *User) error
|
|
GetByID(ctx context.Context, id string) (*User, error)
|
|
GetByUsername(ctx context.Context, username string) (*User, error)
|
|
}
|
|
|
|
type ChatRepository interface {
|
|
Create(ctx context.Context, chat *Chat) error
|
|
GetByID(ctx context.Context, id string) (*Chat, error)
|
|
ListByMember(ctx context.Context, userID string, limit int, cursor *string) ([]Chat, *string, error)
|
|
}
|
|
|
|
type MessageRepository interface {
|
|
Create(ctx context.Context, message *Message) error
|
|
ListByChat(ctx context.Context, chatID string, limit int, cursor *string) ([]Message, *string, error)
|
|
}
|
|
|
|
type SessionRepository interface {
|
|
Create(ctx context.Context, session *Session) error
|
|
GetByTokenHash(ctx context.Context, tokenHash []byte) (*Session, error)
|
|
DeleteByTokenHash(ctx context.Context, tokenHash []byte) error
|
|
}
|