mypostgres

package
v1.0.0-alpha Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsUniqueViolationError

func IsUniqueViolationError(err error) bool

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

func (sr *SessionRepository) DeleteSessionByID(ctx context.Context, sessionID uuid.UUID) error

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 (ur *UserRepository) DeleteUserByID(ctx context.Context, id uuid.UUID) error

func (*UserRepository) GetUserByEmail

func (ur *UserRepository) GetUserByEmail(ctx context.Context, email string) (core.User, error)

func (*UserRepository) GetUserByID

func (ur *UserRepository) GetUserByID(ctx context.Context, id uuid.UUID) (core.User, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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