Documentation
¶
Index ¶
- func ColumnToFieldType(dataType string) admin.FieldType
- func IsLikelyEmail(col Column) bool
- func IsLikelyPassword(col Column) bool
- func IsLikelyPrimaryKey(col Column) bool
- func IsLikelyTimestamp(col Column) bool
- func IsSearchable(col Column) bool
- func IsSortable(col Column) bool
- func SuggestFieldType(col Column) admin.FieldType
- type Column
- type Schema
- type Table
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ColumnToFieldType ¶
ColumnToFieldType maps a PostgreSQL data_type string to the closest admin.FieldType. The mapping is intentionally conservative: types that need domain knowledge (e.g. an "integer" that represents money) should be overridden after generation.
func IsLikelyEmail ¶
IsLikelyEmail returns true when a column name strongly suggests an email address.
func IsLikelyPassword ¶
IsLikelyPassword returns true when a column name strongly suggests a stored password.
func IsLikelyPrimaryKey ¶
IsLikelyPrimaryKey returns true when the column name and type look like a primary key.
func IsLikelyTimestamp ¶
IsLikelyTimestamp returns true when a column appears to be a timestamp field.
func IsSearchable ¶
IsSearchable returns true for column types that are reasonable to full-text search.
func IsSortable ¶
IsSortable returns true for column types that support ORDER BY sensibly.
func SuggestFieldType ¶
SuggestFieldType returns a more precise FieldType by considering both the PostgreSQL data type and the column name heuristics.
Types ¶
type Column ¶
type Column struct {
Name string `json:"name"`
DataType string `json:"data_type"`
Nullable bool `json:"nullable"`
Default string `json:"default,omitempty"`
IsIdentity bool `json:"is_identity"`
}
Column represents a single column in a table.