Documentation ¶
Index ¶
- func ValidateCreateRequest(c *auth.CreateRuleRequest) error
- func ValidateUpdateRequest(u *auth.UpdateRuleRequest) error
- type API
- type MockRepository
- func (m *MockRepository) All(ctx context.Context) ([]entity.Rule, error)
- func (m MockRepository) Count(ctx context.Context) (int64, error)
- func (m *MockRepository) Create(ctx context.Context, rule entity.Rule) (string, error)
- func (m *MockRepository) Delete(ctx context.Context, rule entity.Rule) error
- func (m MockRepository) Get(ctx context.Context, id string) (entity.Rule, error)
- func (m MockRepository) Query(ctx context.Context, query string, offset, limit int64) ([]entity.Rule, int, error)
- func (m *MockRepository) Update(ctx context.Context, rule entity.Rule) error
- type Repository
- type Service
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ValidateCreateRequest ¶
func ValidateCreateRequest(c *auth.CreateRuleRequest) error
ValidateCreateRequest validates the CreateRuleRequest fields.
func ValidateUpdateRequest ¶
func ValidateUpdateRequest(u *auth.UpdateRuleRequest) error
Validate validates the UpdateRuleRequest fields.
Types ¶
type MockRepository ¶
type MockRepository struct {
// contains filtered or unexported fields
}
MockRepository rules mock repository
func NewMockRepository ¶
func NewMockRepository() *MockRepository
NewMockRepository create a mock repository for rules
type Repository ¶
type Repository interface { // Get returns the rule with the specified rule UUID. Get(ctx context.Context, uuid string) (entity.Rule, error) // Count returns the number of rules. Count(ctx context.Context) (int64, error) // Query returns the list of rules with the given offset and limit. Query(ctx context.Context, query string, offset, limit int64) ([]entity.Rule, int, error) // Create saves a new rule in the storage. Create(ctx context.Context, rule entity.Rule) (string, error) // Update updates the rule with given UUID in the storage. Update(ctx context.Context, rule entity.Rule) error // Delete removes the rule with given UUID from the storage. Delete(ctx context.Context, rule entity.Rule) error // All retrieves all rules records from the database. All(ctx context.Context) ([]entity.Rule, error) }
Repository encapsulates the logic to access rules from the data source.
func NewRepository ¶
func NewRepository(db *db.DB) Repository
NewRepository creates a new rule repository
type Service ¶
type Service interface { Get(ctx context.Context, uuid string) (*auth.Rule, error) Query(ctx context.Context, query string, offset, limit int64) (*auth.ListRulesResponse, error) Count(ctx context.Context) (int64, error) Create(ctx context.Context, input *auth.CreateRuleRequest) (*auth.Rule, error) Update(ctx context.Context, input *auth.UpdateRuleRequest) (*auth.Rule, error) Delete(ctx context.Context, uuid string) (*auth.Rule, error) All(ctx context.Context) ([]entity.Rule, error) }
Service encapsulates use case logic for rules.
func NewService ¶
func NewService(repo Repository, domainsRepo domains.Repository, rolesRepo roles.Repository) Service
NewService creates a new rule service.
Click to show internal directories.
Click to hide internal directories.