notify

package
v0.53.0 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidLevel = fmt.Errorf("not a valid Level, try [%s]", strings.Join(_LevelNames, ", "))

Functions

func LevelNames added in v0.52.0

func LevelNames() []string

LevelNames returns a list of possible string values of Level.

Types

type Level

type Level string

Level represents the severity of a notification.

ENUM(

info
warning
error

)

const (
	// LevelInfo is a Level of type info.
	LevelInfo Level = "info"
	// LevelWarning is a Level of type warning.
	LevelWarning Level = "warning"
	// LevelError is a Level of type error.
	LevelError Level = "error"
)

func ParseLevel added in v0.52.0

func ParseLevel(name string) (Level, error)

ParseLevel attempts to convert a string to a Level.

func (*Level) AppendText added in v0.52.0

func (x *Level) AppendText(b []byte) ([]byte, error)

AppendText appends the textual representation of itself to the end of b (allocating a larger slice if necessary) and returns the updated slice.

Implementations must not retain b, nor mutate any bytes within b[:len(b)].

func (Level) IsValid added in v0.52.0

func (x Level) IsValid() bool

IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values

func (Level) MarshalText added in v0.52.0

func (x Level) MarshalText() ([]byte, error)

MarshalText implements the text marshaller method.

func (Level) String added in v0.52.0

func (x Level) String() string

String implements the Stringer interface.

func (*Level) UnmarshalText added in v0.52.0

func (x *Level) UnmarshalText(text []byte) error

UnmarshalText implements the text unmarshaller method.

type Notification

type Notification struct {
	ID        int64
	Level     Level
	Message   string
	CreatedAt time.Time
}

Notification represents a single notification event.

type Store

type Store interface {
	Save(ctx context.Context, n Notification) (int64, error)
	List(ctx context.Context) ([]Notification, error)
	Clear(ctx context.Context) error
	Count(ctx context.Context) (int64, error)
}

Store persists notifications to durable storage.

Jump to

Keyboard shortcuts

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