Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ValidateCreateRequest ¶
func ValidateCreateRequest(c *rolesProto.CreateRoleRequest) error
ValidateCreateRequest validates the CreateRoleRequest fields.
func ValidateUpdateRequest ¶
func ValidateUpdateRequest(u *rolesProto.UpdateRoleRequest) error
Validate validates the UpdateRoleRequest fields.
Types ¶
type API ¶
type API interface { grpcgw.Controller roles.RoleServiceServer }
type Repository ¶
type Repository interface { // Get returns the role with the specified role UUID. Get(ctx context.Context, uuid 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, offset, limit int64) ([]entity.Role, int, error) // Create saves a new role in the storage. Create(ctx context.Context, role entity.Role) 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, uuid string) 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) (*rolesProto.Role, error) Query(ctx context.Context, offset, limit int64) (*rolesProto.ListRolesResponse, error) Count(ctx context.Context) (int64, error) Create(ctx context.Context, input *rolesProto.CreateRoleRequest) (*rolesProto.Role, error) Update(ctx context.Context, input *rolesProto.UpdateRoleRequest) (*rolesProto.Role, error) Delete(ctx context.Context, uuid string) (*rolesProto.Role, error) }
Service encapsulates use case logic for roles.
Click to show internal directories.
Click to hide internal directories.