fieldkind

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package fieldkind generates a value from what a field is called.

A schema can say a property is a string and nothing more. Everything that makes the value recognisable — that it is a token, an address, a timezone — lives in its name, and synth already knows how to read one: infer.Kind maps "email", "token", "timezone" onto real kinds. What it does not do is read a *qualified* name: its table has "token" and "id" but not "access_token" or "session_id", which is what real payloads are full of. Alias closes that gap by falling back to the head word, and String turns the result into a value.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Alias

func Alias(name string) (string, bool)

Alias returns the name synth recognises for this field, and whether it found one. It tries the name itself first, then progressively shorter tails ("access_token" -> "token"), then the head ("email_address" -> "email"), and finally the singular of a plural ("emails" -> "email").

func String

func String(name string, seed uint64) (string, bool)

String generates a value for the field, seeded by the caller: a mock wants the same body every run, a body generator wants a fresh one. ok is false when the name says nothing, and the caller should keep its own placeholder rather than invent prose for a field nothing is known about.

Types

This section is empty.

Jump to

Keyboard shortcuts

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