Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetSQLType ¶
GetSQLType retorna o tipo SQL baseado no tipo Go
Types ¶
type FieldMetadata ¶
type FieldMetadata struct {
Name string
Type string
Writable []string // POST, PUT, PATCH
Readable bool
Required bool
Unique bool
PrimaryKey bool
AutoInc bool
Validations map[string]string
Relation *Relation
JSONTag string
GORMTag string
Default string
Index bool
Ignore bool
IgnoreWrite bool
IgnoreRead bool
}
FieldMetadata contém metadados de um campo do model
func (*FieldMetadata) IsReadable ¶
func (f *FieldMetadata) IsReadable() bool
IsReadable verifica se o campo pode ser lido
func (*FieldMetadata) IsWritableInMethod ¶
func (f *FieldMetadata) IsWritableInMethod(method string) bool
IsWritableInMethod verifica se o campo pode ser escrito no método HTTP especificado
func (*FieldMetadata) ValidateValue ¶
func (f *FieldMetadata) ValidateValue(value interface{}) error
ValidateValue valida um valor baseado nas validações do campo
type ModelMetadata ¶
type ModelMetadata struct {
Name string
Package string
TableName string
Fields []FieldMetadata
Imports []string
}
ModelMetadata contém metadados completos de um model
func ParseModelFile ¶
func ParseModelFile(filePath string) (*ModelMetadata, error)
ParseModelFile lê um arquivo .go e extrai metadata
Click to show internal directories.
Click to hide internal directories.