Documentation ¶
Overview ¶
Package entity defines all structs that flow through all application layers.
Index ¶
- func ErrAlreadyExists() error
- func ErrEmptyToggle() error
- func ErrInternal(message string) error
- func ErrInvalidKey() error
- func ErrInvalidValue() error
- func ErrNotFound() error
- func ErrProhibitedToDelete() error
- func EventToggleCreated(toggle *Toggle) *togglev1.ToggleEvent
- func EventToggleDeleted(toggle *Toggle) *togglev1.ToggleEvent
- func EventToggleDisabled(toggle *Toggle) *togglev1.ToggleEvent
- func EventToggleEnabled(toggle *Toggle) *togglev1.ToggleEvent
- type Toggle
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ErrAlreadyExists ¶
func ErrAlreadyExists() error
ErrAlreadyExists returns codes.AlreadyExists explained that the key already exists.
func ErrEmptyToggle ¶
func ErrEmptyToggle() error
ErrEmptyToggle returns codes.InvalidArgument explained that the instance is empty or nil.
func ErrInternal ¶
ErrInternal returns codes.Internal explained that unexpected behavior occurred in system.
func ErrInvalidKey ¶
func ErrInvalidKey() error
ErrInvalidKey returns codes.InvalidArgument explained that the toggle's key is invalid.
func ErrInvalidValue ¶
func ErrInvalidValue() error
ErrInvalidValue returns codes.InvalidArgument explained that the toggle's value is invalid.
func ErrNotFound ¶
func ErrNotFound() error
ErrNotFound returns codes.NotFound explained that the toggle is not found.
func ErrProhibitedToDelete ¶
func ErrProhibitedToDelete() error
ErrProhibitedToDelete returns codes.FailedPrecondition explained that the toggle's value is true and can't be deleted.
func EventToggleCreated ¶
func EventToggleCreated(toggle *Toggle) *togglev1.ToggleEvent
EventToggleCreated creates an event for created toggle.
func EventToggleDeleted ¶
func EventToggleDeleted(toggle *Toggle) *togglev1.ToggleEvent
EventToggleDeleted creates an event for deleted toggle.
func EventToggleDisabled ¶
func EventToggleDisabled(toggle *Toggle) *togglev1.ToggleEvent
EventToggleDisabled creates an event for disabled toggle.
func EventToggleEnabled ¶
func EventToggleEnabled(toggle *Toggle) *togglev1.ToggleEvent
EventToggleEnabled creates an event for enabled toggle.
Types ¶
type Toggle ¶
type Toggle struct { // Key defines the toggle's identifier. // It must be unique from the rest. Key string // IsEnabled defines the toggle's value. IsEnabled bool // Description defines toggle's description. Description string // CreatedAt defines the time when the toggle was created. CreatedAt time.Time // Updated defines the time when the toggle was last updated. UpdatedAt time.Time }
Toggle defines the logical data of a toggle.