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.
34 lines
631 B
34 lines
631 B
3 years ago
|
package sharedmodel
|
||
|
|
||
|
import (
|
||
|
"encoding/json"
|
||
|
|
||
|
"gorm.io/gorm"
|
||
|
)
|
||
|
|
||
|
type Subscription struct {
|
||
|
gorm.Model
|
||
|
SubjectExternalId string
|
||
|
SubjectExternalIdSystem string
|
||
|
SubjectName string
|
||
|
SubjectBirthdate string
|
||
|
ProtocolMeta string
|
||
|
ServiceConfigID uint
|
||
|
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
|
||
|
}
|