Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewMockRepository ¶
func NewMockRepository() *mockRepository
func ValidateCreateRequest ¶
func ValidateCreateRequest(c *auth.CreateRoleRequest) error
ValidateCreateRequest validates the CreateRoleRequest fields.
func ValidateUpdateRequest ¶
func ValidateUpdateRequest(u *auth.UpdateRoleRequest) error
Validate validates the UpdateRoleRequest fields.
Types ¶
type Repository ¶
type Repository interface { // Get returns the role with the specified role UUID. Get(ctx context.Context, uuid string) (entity.Role, error) // GetByTitle returns the role with the specified role title. GetByTitle(ctx context.Context, title string) (entity.Role, error) // Count returns the number of roles. Count(ctx context.Context) (int64, error) // Query returns the list of roles with the given offset and limit. Query(ctx context.Context, query string, offset, limit int64) ([]entity.Role, int, error) // Create saves a new role in the storage. Create(ctx context.Context, role entity.Role) (string, error) // Update updates the role with given UUID in the storage. Update(ctx context.Context, role entity.Role) error // Delete removes the role with given UUID from the storage. Delete(ctx context.Context, role entity.Role) error }
Repository encapsulates the logic to access roles from the data source.
func NewRepository ¶
func NewRepository(db *db.DB) Repository
NewRepository creates a new role repository
type Service ¶
type Service interface { Get(ctx context.Context, uuid string) (*auth.Role, error) Query(ctx context.Context, query string, offset, limit int64) (*auth.ListRolesResponse, error) Count(ctx context.Context) (int64, error) Create(ctx context.Context, input *auth.CreateRoleRequest) (*auth.Role, error) Update(ctx context.Context, input *auth.UpdateRoleRequest) (*auth.Role, error) Delete(ctx context.Context, uuid string) (*auth.Role, error) }
Service encapsulates use case logic for roles.
Click to show internal directories.
Click to hide internal directories.