Documentation
¶
Overview ¶
Package modelmeta shares field naming and tag parsing between declarations and generation.
Index ¶
- func FieldAt(model reflect.Type, template, ptr unsafe.Pointer, typ reflect.Type) (int, error)
- func FieldMethodPrefix(name string) string
- func Fingerprint(fields []FieldTag) string
- func IdentityVariable(table string) string
- func ModelIdentifier(name string) bool
- func NearFoundry(key string) bool
- func OffsetMatches(t reflect.Type, offset uintptr, target reflect.Type) int
- func ParseTags(text string) (map[string]string, error)
- func Snake(name string) string
- func ValidMutatorInput(t reflect.Type) bool
- type FieldMethod
- type FieldTag
- type ModelTag
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FieldMethodPrefix ¶
FieldMethodPrefix identifies the shared model field-method convention. Example: FieldMethodPrefix("MutateEmail").
func Fingerprint ¶ added in v0.51.0
Fingerprint covers ordered field names and the presence and exact value of their foundry tag. Length prefixes make the representation unambiguous.
func IdentityVariable ¶ added in v0.51.0
IdentityVariable lowercases the first word, treating an initialism as one word.
func ModelIdentifier ¶ added in v0.51.0
ModelIdentifier excludes keywords and the blank identifier from generated names.
func NearFoundry ¶ added in v0.51.0
NearFoundry reports a likely misspelling of the declaration namespace.
func OffsetMatches ¶
OffsetMatches includes nested fields and zero-sized neighbors in ambiguity checks.
func ParseTags ¶
ParseTags rejects malformed and repeated struct tags. Example: ParseTags(`foundry:"-"`).
func ValidMutatorInput ¶
ValidMutatorInput rejects interfaces and nullable wrappers at declaration boundaries. Example: ValidMutatorInput(reflect.TypeFor[EmailInput]()).
Types ¶
type FieldMethod ¶
FieldMethod describes a validated, unbound model method without invoking it. Example: methods, err := FieldMethods(reflect.TypeFor[Member](), fields).
func FieldMethods ¶
FieldMethods checks value and pointer method sets, retaining value receivers only. Fields contains persisted fields and their non-null stored types.
type FieldTag ¶ added in v0.51.0
type FieldTag struct{ Name, Tag string }
FieldTag describes one model field in declaration order. Tag is its whole Go tag.
type ModelTag ¶ added in v0.51.0
type ModelTag struct {
Column string
DatabaseDefault bool
Role, Input, Mutate, Codec, Member, KeyRole string
Slot, Ignore bool
}
ModelTag is the shared field declaration parsed before type-specific validation. StorageTag retains only the options that describe a persisted column.
func ParseModelTag ¶ added in v0.51.0
ParseModelTag validates the complete struct tag, including misspelled namespaces. Field type and table-option compatibility are checked by the declaration owner.
func (ModelTag) StorageTag ¶ added in v0.51.0
StorageTag returns the existing column/default grammar without generator options.