The types module provides a shared type catalog and helpers used across generated apps. It defines type metadata, JSON-friendly type definitions, and view helpers for rendering or editing values by type.
types.Typedescribes a value's key, sortability, scalar-ness, conversion (From), and default value (Default).types.Wrappedwraps concrete types for JSON round-tripping and convenience constructors (NewString,NewList, and friends).- Helper utilities:
TypeAs,IsString/IsBool/IsInt/IsList,Bits, andFromReflect. - View components:
views/components/view/AnyByTypeandviews/components/edit/AnyByTyperender values and inputs based on atypes.Wrapped.
- Primitive:
any,bit,bool,byte,char,int,float,numeric,string - Temporal:
date,time,timestamp,timestampZoned - Identifiers / references:
uuid,enum,enumValue,reference - Structured:
list,map,orderedMap,set,valueMap,numericMap,option,range,union,method - Special:
json,xml,nil,unknown,error
Notes:
valueMapis a string-keyed map of arbitrary values.numericandnumericMapare intended to pair with thenumericmodule's implementations.
str := types.NewString()
name := types.NewStringArgs(1, 80, "^[a-zA-Z0-9_-]+$")
scores := types.NewList(types.NewInt(64))
valueMap := types.NewValueMap()_ = util.ToJSONCompact(types.NewString()) // "string"
_ = util.ToJSONCompact(types.NewList(types.NewString())) // {"k":"list","t":{"v":"string"}}
_, _ = util.FromJSONObj[*types.Wrapped]([]byte(`"int"`))- Repository: https://github.com/kyleu/projectforge/tree/main/module/types
- License: CC0 (Public Domain)
- Author: Kyle U (kyle@kyleu.com)
- Numeric Module - Numeric runtime types
- Project Forge Documentation - Complete documentation