Overview
Sentinel is a Go package for extracting struct metadata. It takes what reflection gives you—field names, types, kinds, tags, relationships—and normalizes it into a consistent, queryable format. It's the foundation for type-driven development: scan your types once at startup, then access that metadata anywhere in your application.
The Idea
Go's type system already knows a lot about your domain: field names, types, struct tags, how types relate to each other. The problem is that reflection makes you work for it—low-level APIs, careful handling, repetitive boilerplate.
What if accessing struct metadata was trivial?
That's the question Sentinel answers. The goal is to make domain types the single source of truth—define your structs once, and let tooling derive schemas, documentation, validation, and queries from that definition. Sentinel handles the extraction and normalization.
From there, other packages do their work: schema generators read field types, documentation tools map relationships, validators pull rules from tags, query builders use field metadata. Sentinel does the extraction—what gets built on top is up to you.
The Implementation
Two functions, two use cases:
Inspect examines a single type in isolation. Scan traverses your entire domain model from one entry point, discovering all related types within your module.
Both return normalized metadata—field names, types, kinds, tags, relationships—cached permanently after the first call.
What It Enables
See it in action:
- Entity relationship diagrams with erd
- Type-safe SQL queries with soy
- OpenAPI documentation with rocco
Next Steps
- Quickstart — installation and basic usage
- Concepts — metadata structures and caching
- Architecture — internal design
- API Reference — complete function documentation