Add Name & Type to types.Field
This commit is contained in:
parent
601f512667
commit
3bbb094e84
@ -9,7 +9,10 @@
|
||||
"struct": [
|
||||
{
|
||||
"name": "Field",
|
||||
"fields": []
|
||||
"fields": [
|
||||
{ "name": "Name", "type": "string", "tag": "json:\"name\"" },
|
||||
{ "name": "Type", "type": "string", "tag": "json:\"type\"" }
|
||||
]
|
||||
}
|
||||
],
|
||||
"apis": [
|
||||
@ -114,4 +117,4 @@
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
]
|
||||
|
||||
@ -5,7 +5,18 @@
|
||||
"Interface": "Field",
|
||||
"Struct": [
|
||||
{
|
||||
"fields": [],
|
||||
"fields": [
|
||||
{
|
||||
"name": "Name",
|
||||
"tag": "json:\"name\"",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "Type",
|
||||
"tag": "json:\"type\"",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"name": "Field"
|
||||
}
|
||||
],
|
||||
|
||||
@ -18,6 +18,9 @@ package types
|
||||
type (
|
||||
// Fields
|
||||
Field struct {
|
||||
Name string `json:"name" db:"name"`
|
||||
Type string `json:"type" db:"type"`
|
||||
|
||||
changed []string
|
||||
}
|
||||
)
|
||||
@ -28,3 +31,25 @@ func (Field) New() *Field {
|
||||
}
|
||||
|
||||
/* Getters/setters */
|
||||
func (f *Field) GetName() string {
|
||||
return f.Name
|
||||
}
|
||||
|
||||
func (f *Field) SetName(value string) *Field {
|
||||
if f.Name != value {
|
||||
f.changed = append(f.changed, "Name")
|
||||
f.Name = value
|
||||
}
|
||||
return f
|
||||
}
|
||||
func (f *Field) GetType() string {
|
||||
return f.Type
|
||||
}
|
||||
|
||||
func (f *Field) SetType(value string) *Field {
|
||||
if f.Type != value {
|
||||
f.changed = append(f.changed, "Type")
|
||||
f.Type = value
|
||||
}
|
||||
return f
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user