Documentation
¶
Overview ¶
Package repo provides interfaces and structures to interact with database.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrNoRows = errors.New("no rows in result set")
)
Functions ¶
func NewRolePostgres ¶
NewRolePostgres creates a new rolePostgres. It returns pointer to a rolePostgres instance.
func NewTokenPostgres ¶
NewTokenPostgres creates a new tokenPostgres. It returns pointer to a tokenPostgres instance.
func NewUserPostgres ¶
NewUserPostgres creates a new userPostgres. It returns pointer to an userPostgres instance.
Types ¶
type Role ¶
type Role interface { // Create creates a new role. // It returns pointer to an entity.Role instance. Create(ctx context.Context, data entity.Role) (*entity.Role, error) // GetByID gets a role by ID. // It returns pointer to an entity.Role instance. GetByID(ctx context.Context, id uuid.UUID) (*entity.Role, error) // GetByUser gets roles by user ID. // It returns slice of entity.Role instances. GetByUser(ctx context.Context, userID uuid.UUID) ([]entity.Role, error) // DeleteByID deletes a role by ID. DeleteByID(ctx context.Context, id uuid.UUID) error // DeleteByUser deletes user-related roles by user ID. DeleteByUser(ctx context.Context, userID uuid.UUID) error }
Role is interface implemented by types that can interact with role entity.
type Token ¶
type Token interface { // Create creates a new refresh token. // It returns pointer to an entity.RefreshToken instance. Create(ctx context.Context, data entity.RefreshToken) (*entity.RefreshToken, error) // GetByID gets a refresh token by ID. // It returns pointer to an entity.RefreshToken instance. GetByID(ctx context.Context, id uuid.UUID) (*entity.RefreshToken, error) // GetByUser gets refresh tokens by user ID. // It returns slice of entity.RefreshToken instances. GetByUser(ctx context.Context, userID uuid.UUID) ([]entity.RefreshToken, error) // DeleteByID deletes a refresh token by ID. DeleteByID(ctx context.Context, id uuid.UUID) error // DeleteByUser deletes user-related refresh tokens by user ID. DeleteByUser(ctx context.Context, userID uuid.UUID) error }
Token is interface implemented by types that can interact with token entity.
type User ¶
type User interface { // Create creates a new user. // It returns pointer to an entity.User instance. Create(ctx context.Context, data entity.User) (*entity.User, error) // GetByID gets a user by ID. // It returns pointer to an entity.User instance. GetByID(ctx context.Context, id uuid.UUID) (*entity.User, error) // GetByName gets a user by unique name. // It returns pointer to an entity.User instance. GetByName(ctx context.Context, name string) (*entity.User, error) // UpdatePassword updates user's password by user ID. UpdatePassword(ctx context.Context, id uuid.UUID, password []byte) error // DeleteByID deletes a user by ID. DeleteByID(ctx context.Context, id uuid.UUID) error }
User is interface implemented by types that can interact with user entity.
Click to show internal directories.
Click to hide internal directories.