prims

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2026 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

Package prims is the catalogue of the DSL's built-in type spellings. One row per name carries every fact the analyser, the code generators, and the language server read about it, so a built-in is described once.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Capacity

func Capacity(name string) (lo, hi float64, ok bool)

Capacity returns the value range an integer kind can hold; ok is false for every other name.

func Is

func Is(name string) bool

Is reports whether name is a built-in type spelling.

func IsInteger

func IsInteger(name string) bool

IsInteger reports whether name is a signed or unsigned integer kind.

func IsNumeric

func IsNumeric(name string) bool

IsNumeric reports whether name is an integer or float kind.

func IsUnsigned

func IsUnsigned(name string) bool

IsUnsigned reports whether name is an unsigned integer kind.

func IsWireParseable

func IsWireParseable(name string) bool

IsWireParseable reports whether a wire-string binder (`@query`, `@header`, `@cookie`, `@form`) can parse name from a single string: string, bool, and the integer and float kinds.

Types

type Kind

type Kind uint8

Kind classifies a built-in by the values it holds.

const (
	String Kind = iota + 1
	Bool
	Int
	Uint
	Float
	Bytes  // raw byte buffer
	Any    // opaque JSON value
	File   // multipart upload
	Object // bag of fields, valid only inside `@example({...})`
)

type Spec

type Spec struct {
	Name string
	Kind Kind
	// Bits is the width of a sized integer or float (8, 16, 32, 64); 0
	// for the platform-sized `int` / `uint` and for non-numeric kinds.
	Bits int
	// Go is the Go type the name lowers to; "" when it has none.
	Go string
	// Parser is the strconv function a wire-string binder parses the
	// value with; "" for `string` (used verbatim) and for kinds with no
	// wire form.
	Parser string
	// OASType and OASFormat are the OpenAPI schema `type` and `format`;
	// an empty OASType is an unconstrained schema.
	OASType, OASFormat string
	// Lo and Hi bound the values an integer kind can hold.
	Lo, Hi float64
	// Doc is the hover text the language server shows.
	Doc string
}

Spec describes one built-in type.

func All

func All() []Spec

All returns every built-in in catalogue order.

func Lookup

func Lookup(name string) (Spec, bool)

Lookup returns the spec for name and whether name is a built-in.

Jump to

Keyboard shortcuts

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