Documentation ¶
Index ¶
- func IsUniqueViolationError(err error) bool
- func WithSessionDuration(d time.Duration) func(*SessionRepository)
- type SessionRepository
- func (sr *SessionRepository) CreateSession(ctx context.Context, params core.CreateSessionParams) error
- func (sr *SessionRepository) DeleteSessionByID(ctx context.Context, sessionID uuid.UUID) error
- func (sr *SessionRepository) GetSessionByID(ctx context.Context, id uuid.UUID) (core.Session, error)
- func (sr *SessionRepository) GetUserSessions(ctx context.Context, userID uuid.UUID) ([]core.Session, error)
- func (sr *SessionRepository) UpdateSessionTokens(ctx context.Context, params core.UpdateSessionTokenParams) error
- type UserRepository
- func (ur *UserRepository) CreateUser(ctx context.Context, arg core.CreateUserParams) error
- func (ur *UserRepository) DeleteUserByID(ctx context.Context, id uuid.UUID) error
- func (ur *UserRepository) GetUserByEmail(ctx context.Context, email string) (core.User, error)
- func (ur *UserRepository) GetUserByID(ctx context.Context, id uuid.UUID) (core.User, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsUniqueViolationError ¶
IsUniqueViolationError checks if an error is a unique violation error
func WithSessionDuration ¶
func WithSessionDuration(d time.Duration) func(*SessionRepository)
WithSessionDuration is a functional option to set the sessions time duration
Types ¶
type SessionRepository ¶
type SessionRepository struct {
// contains filtered or unexported fields
}
func NewSessionRepository ¶
func NewSessionRepository(conn *sql.DB, opts ...func(*SessionRepository)) (*SessionRepository, error)
NewSessionRepository creates a new sessions repository with the given connection
func (*SessionRepository) CreateSession ¶
func (sr *SessionRepository) CreateSession(ctx context.Context, params core.CreateSessionParams) error
CreateSession creates a new sessions for a user
func (*SessionRepository) DeleteSessionByID ¶
DeleteSessionByID deletes a sessions by its id
func (*SessionRepository) GetSessionByID ¶
func (sr *SessionRepository) GetSessionByID(ctx context.Context, id uuid.UUID) (core.Session, error)
GetSessionByID returns a sessions by its id
func (*SessionRepository) GetUserSessions ¶
func (sr *SessionRepository) GetUserSessions(ctx context.Context, userID uuid.UUID) ([]core.Session, error)
GetUserSessions returns all sessions owned by a single user
func (*SessionRepository) UpdateSessionTokens ¶
func (sr *SessionRepository) UpdateSessionTokens(ctx context.Context, params core.UpdateSessionTokenParams) error
UpdateSessionTokens returns a sessions by its refresh token value
type UserRepository ¶
type UserRepository struct {
// contains filtered or unexported fields
}
func NewUserRepository ¶
func NewUserRepository(conn *sql.DB) (*UserRepository, error)
func (*UserRepository) CreateUser ¶
func (ur *UserRepository) CreateUser(ctx context.Context, arg core.CreateUserParams) error
func (*UserRepository) DeleteUserByID ¶
func (*UserRepository) GetUserByEmail ¶
func (*UserRepository) GetUserByID ¶
Click to show internal directories.
Click to hide internal directories.