kit

package
v0.1.13 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package kit holds the small value helpers the x/ packages share: pointer and slice conveniences that adapters (GraphQL, MCP, the store) need when mapping between optional API fields and Go values.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Deref

func Deref(s *string) string

Deref is *s, or "" when s is nil.

func DerefBool

func DerefBool(b *bool) bool

DerefBool is *b, or false when b is nil.

func DerefInt

func DerefInt(n *int, fallback int) int

DerefInt is *n, or fallback when n is nil.

func Optional

func Optional(s string) *string

Optional is a pointer to s, or nil when s is empty: unset text is null.

func OrEmpty

func OrEmpty[T any](s []T) []T

OrEmpty is s, or an empty slice when s is nil: a non-null API list.

func Ptr

func Ptr[T any](v T) *T

Ptr is a pointer to v.

func SortedKeys

func SortedKeys[V any](m map[string]V) []string

SortedKeys are the keys of m, sorted.

Types

This section is empty.

Jump to

Keyboard shortcuts

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