Documentation
¶
Overview ¶
Package tagparser provides a high-performance struct tag parser for grove:"..." and bun:"..." tags. It extracts column names, boolean options, and key:value pairs from comma-separated tag strings.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Tag ¶
type Tag struct {
Name string // Column name or empty
Options map[string]string // Key-value options (e.g., "pk" -> "", "type" -> "jsonb", "privacy" -> "pii")
}
Tag represents a parsed struct tag.
func Parse ¶
Parse parses a raw struct tag value like "column_name,pk,notnull,type:jsonb,default:'active'" into a Tag. It handles:
- First non-option token is the column name
- Boolean options like "pk", "notnull", "autoincrement" -> key="pk" value=""
- Key:value options like "type:jsonb", "privacy:pii" -> key="type" value="jsonb"
- Quoted values like "default:'hello world'" -> key="default" value="hello world"
- Table-level options like "table:users,alias:u"
Click to show internal directories.
Click to hide internal directories.