notification

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package notification builds notification receivers from permission and resource policies.

Receivers are resolved at send time from a pluggable policy Resolver (for example an RBAC service), then filtered by channel type, producing a typed Notification ready to be dispatched.

Index

Constants

View Source
const (
	R = "r" // R read
	W = "w" // W write
	X = "x" // X execute
	D = "d" // D delete
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

type Builder[T any] interface {
	Receivers([]*Receiver) Builder[T]
	Types(types ...string) Builder[T]
	B(msg *T) *Notification[T]
}

func New

func New[T any]() Builder[T]

type Notification

type Notification[T any] struct {
	Receivers []*Receiver
	Msg       *T
}

type PermissionRequest

type PermissionRequest struct {
	Resource string   // Resource requested resource
	Perm     []string // Perm requested permissions (R, W, X, D)
}

type PermissionsRequest

type PermissionsRequest struct {
	Items []*PermissionRequest
}

type Receiver

type Receiver struct {
	Type     string
	Receiver string
}

type ReceiverFn

type ReceiverFn func(resolver Resolver) ([]*Receiver, error)

type Receivers

type Receivers interface {
	Permissions(resolver Resolver) Receivers
	Scopes(fns ...ReceiverFn) Receivers
	B() ([]*Receiver, error)
}

func NewReceivers

func NewReceivers() Receivers

type Resolver

type Resolver interface {
	Resolve() *PermissionsRequest
}

func Resource

func Resource(permissions string, resources ...string) Resolver

Jump to

Keyboard shortcuts

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