entity

package
v0.0.0-...-58ae5d1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 14, 2022 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Overview

Package entity defines all structs that flow through all application layers.

Index

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

func ErrInternal(message string) error

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL