🎨 Update database

This commit is contained in:
Daniel 2023-10-16 23:32:44 +08:00
parent 5ebd406ae7
commit dc6fb939fd
No known key found for this signature in database
GPG Key ID: 86211BA83DF03017

View File

@ -123,38 +123,77 @@ type Value struct {
func (value *Value) String() string { func (value *Value) String() string {
switch value.Type { switch value.Type {
case KeyTypeBlock: case KeyTypeBlock:
if nil == value.Block {
return ""
}
return value.Block.Content return value.Block.Content
case KeyTypeText: case KeyTypeText:
if nil == value.Text {
return ""
}
return value.Text.Content return value.Text.Content
case KeyTypeNumber: case KeyTypeNumber:
if nil == value.Number {
return ""
}
return value.Number.FormattedContent return value.Number.FormattedContent
case KeyTypeDate: case KeyTypeDate:
if nil == value.Date {
return ""
}
return value.Date.FormattedContent return value.Date.FormattedContent
case KeyTypeSelect: case KeyTypeSelect:
if 1 > len(value.MSelect) {
return ""
}
return value.MSelect[0].Content return value.MSelect[0].Content
case KeyTypeMSelect: case KeyTypeMSelect:
if 1 > len(value.MSelect) {
return ""
}
var ret []string var ret []string
for _, v := range value.MSelect { for _, v := range value.MSelect {
ret = append(ret, v.Content) ret = append(ret, v.Content)
} }
return strings.Join(ret, " ") return strings.Join(ret, " ")
case KeyTypeURL: case KeyTypeURL:
if nil == value.URL {
return ""
}
return value.URL.Content return value.URL.Content
case KeyTypeEmail: case KeyTypeEmail:
if nil == value.Email {
return ""
}
return value.Email.Content return value.Email.Content
case KeyTypePhone: case KeyTypePhone:
if nil == value.Phone {
return ""
}
return value.Phone.Content return value.Phone.Content
case KeyTypeMAsset: case KeyTypeMAsset:
if 1 > len(value.MAsset) {
return ""
}
var ret []string var ret []string
for _, v := range value.MAsset { for _, v := range value.MAsset {
ret = append(ret, v.Content) ret = append(ret, v.Content)
} }
return strings.Join(ret, " ") return strings.Join(ret, " ")
case KeyTypeTemplate: case KeyTypeTemplate:
if nil == value.Template {
return ""
}
return value.Template.Content return value.Template.Content
case KeyTypeCreated: case KeyTypeCreated:
if nil == value.Created {
return ""
}
return value.Created.FormattedContent return value.Created.FormattedContent
case KeyTypeUpdated: case KeyTypeUpdated:
if nil == value.Updated {
return ""
}
return value.Updated.FormattedContent return value.Updated.FormattedContent
default: default:
return "" return ""