You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
okapidemo/sharedmodel/subscription.go

47 lines
1.2 KiB

package sharedmodel
import (
"encoding/json"
"time"
"gorm.io/gorm"
)
type Subscription struct {
ID string `gorm:"primarykey"`
CreatedAt time.Time
UpdatedAt time.Time
DeletedAt gorm.DeletedAt `gorm:"index"`
SubjectExternalId string
SubjectExternalIdSystem string
SubjectDisplayName string
SubjectGiven ListOfStrings `gorm:"type:text"`
SubjectOwnName string
SubjectOwnNamePrefix string
SubjectPartnerName string
SubjectPartnerNamePrefix string
SubjectBirthdate string
SubjectAddressStreet string
SubjectAddressStreetNumber string
SubjectAddressPostalCode string
SubjectAddressCity string
SubjectAddressCountry string
ProtocolMeta string
ServiceConfigID uint `gorm:"primarykey"`
ServiceConfig *ServiceConfig
}
func (s Subscription) GetProtocolMeta(meta interface{}) error {
return json.Unmarshal([]byte(s.ProtocolMeta), meta)
}
func (s *Subscription) SetProtocolMeta(meta interface{}) error {
b, err := json.Marshal(meta)
if err != nil {
return err
}
s.ProtocolMeta = string(b)
return nil
}