Documentation
¶
Overview ¶
Package spec parses and validates go-backend-kit resource specifications.
Index ¶
Constants ¶
View Source
const SchemaVersion = 1
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Field ¶
type Field struct {
Name string `json:"name"`
GoName string `json:"go_name"`
Column string `json:"column"`
Type FieldType `json:"type"`
Required bool `json:"required"`
Nullable bool `json:"nullable"`
HasDefault bool `json:"has_default"`
Default any `json:"default,omitempty"`
Unique bool `json:"unique"`
Index bool `json:"index"`
Enum []string `json:"enum,omitempty"`
Min *float64 `json:"min,omitempty"`
Max *float64 `json:"max,omitempty"`
MaxLength *int `json:"max_length,omitempty"`
Searchable bool `json:"searchable"`
Filterable bool `json:"filterable"`
Sortable bool `json:"sortable"`
}
type FieldType ¶
type FieldType string
const ( TypeString FieldType = "string" TypeText FieldType = "text" TypeBool FieldType = "bool" TypeInt32 FieldType = "int32" TypeInt64 FieldType = "int64" TypeFloat64 FieldType = "float64" TypeDecimal FieldType = "decimal" TypeTime FieldType = "time" TypeUUID FieldType = "uuid" TypeJSON FieldType = "json" )
type Resource ¶
type Resource struct {
SchemaVersion int `json:"schema_version"`
Name string `json:"name"`
Package string `json:"package"`
Table string `json:"table"`
Route string `json:"route"`
Fields []Field `json:"fields"`
}
Resource is the normalized representation used by every generator.
func (Resource) Fingerprint ¶
Fingerprint is a stable digest of the normalized specification.
Click to show internal directories.
Click to hide internal directories.