orgkit

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package orgkit is what the layer plugins (org-management, org-product, ...) share: records kept in the plugin's state, reading the units below through the unit's own org, and the exposure cards.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Card

func Card(r map[string]any) sdk.Node

Card is one exposure row (org.unit.exposed) as a widget.

func Cards

func Cards(c querier, child string, keep func(row map[string]any) bool) (*sdk.Node, error)

Cards renders what the units below expose to this one (child "*") or one child's, as a card each: a source's widget bound to org.unit.show, an action's form bound to org.unit.invoke. keep, when set, picks the exposures to show.

func Children

func Children(c querier) ([]map[string]any, error)

Children are the units below as this unit's org sees them (org.unit.children).

func Each

func Each(c querier, source string) []map[string]any

Each is source (org.unit.kpis, org.unit.people, ...) of every reachable child, each row tagged with its unit.

func List

func List(c state, k Kind) ([]map[string]any, error)

List is kind's records, derived and sorted.

func Num added in v1.10.0

func Num(v any) float64

Num reads a number from a row value the way records and frames carry it.

func Records

func Records(p *sdk.Plugin, k Kind)

Records registers kind's source and action on p.

func Rows

func Rows(f *sdk.Frame) []map[string]any

Rows are a frame's rows.

func Save

func Save(c state, user string, k Kind, a sdk.Args) (*sdk.Result, error)

Save creates, updates or deletes one record from a's fields.

func Str added in v1.10.0

func Str(v any) string

Str reads a string from a row value.

func Table added in v1.10.0

func Table(rows []map[string]any, cols ...string) *sdk.Frame

Table is rows as a frame with cols in order; a column's type comes from its first non-empty value.

func Time added in v1.11.0

func Time(v any) time.Time

Time reads a stored time (RFC3339, 2006-01-02T15:04 or a date); zero when it is none.

Types

type Field

type Field struct {
	Name, Type, Description string
	Required, Computed      bool
	Options                 []string
	Default                 any
	// Format is the form's input (textarea, markdown, date, date-time, email); OptionsFrom fills a
	// select from a source: "source value label". A list type takes many.
	Format, OptionsFrom string
}

type Health added in v1.10.0

type Health struct {
	Name         string  `json:"name"`
	Title        string  `json:"title"`
	Value        float64 `json:"value"`
	Measure      string  `json:"measure"`
	Status       string  `json:"status"`
	OK           int     `json:"ok"`
	Warn         int     `json:"warn"`
	Err          int     `json:"err"`
	High         int     `json:"high"`
	OpenRequests int     `json:"open_requests"`
	Note         string  `json:"note"`
}

Health is a scorecard row per unit below: KPIs on target as the value, coloured by the worst sign.

func HealthOf added in v1.10.0

func HealthOf(c querier) ([]Health, error)

type Kind

type Kind struct {
	Name, Plural, Title string
	Fields              []Field
	// Derive adds computed columns (declared as Computed fields) to a row before it is listed.
	Derive func(row map[string]any)
	// Sort is a field to order by; a leading - sorts descending. Left out, the latest updated first.
	Sort string
	// Private records are seen and changed only by the person who made them.
	Private bool
	// Saved runs after a create or update, with the saved row (a meeting sends its invite).
	Saved func(c *sdk.Ctx, row map[string]any, res *sdk.Result) *sdk.Result
}

Kind is a record type: source <Plural> lists them, action <Name> creates, updates (id) or deletes (delete: true) one.

Jump to

Keyboard shortcuts

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