diff options
Diffstat (limited to 'models/repo_unit.go')
-rw-r--r-- | models/repo_unit.go | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/models/repo_unit.go b/models/repo_unit.go index 8c2d458758..3ef3904833 100644 --- a/models/repo_unit.go +++ b/models/repo_unit.go @@ -5,11 +5,11 @@ package models import ( - "encoding/json" "fmt" "code.gitea.io/gitea/modules/timeutil" + jsoniter "github.com/json-iterator/go" "xorm.io/xorm" "xorm.io/xorm/convert" ) @@ -29,11 +29,13 @@ type UnitConfig struct { // FromDB fills up a UnitConfig from serialized format. func (cfg *UnitConfig) FromDB(bs []byte) error { + json := jsoniter.ConfigCompatibleWithStandardLibrary return json.Unmarshal(bs, &cfg) } // ToDB exports a UnitConfig to a serialized format. func (cfg *UnitConfig) ToDB() ([]byte, error) { + json := jsoniter.ConfigCompatibleWithStandardLibrary return json.Marshal(cfg) } @@ -44,11 +46,13 @@ type ExternalWikiConfig struct { // FromDB fills up a ExternalWikiConfig from serialized format. func (cfg *ExternalWikiConfig) FromDB(bs []byte) error { + json := jsoniter.ConfigCompatibleWithStandardLibrary return json.Unmarshal(bs, &cfg) } // ToDB exports a ExternalWikiConfig to a serialized format. func (cfg *ExternalWikiConfig) ToDB() ([]byte, error) { + json := jsoniter.ConfigCompatibleWithStandardLibrary return json.Marshal(cfg) } @@ -61,11 +65,13 @@ type ExternalTrackerConfig struct { // FromDB fills up a ExternalTrackerConfig from serialized format. func (cfg *ExternalTrackerConfig) FromDB(bs []byte) error { + json := jsoniter.ConfigCompatibleWithStandardLibrary return json.Unmarshal(bs, &cfg) } // ToDB exports a ExternalTrackerConfig to a serialized format. func (cfg *ExternalTrackerConfig) ToDB() ([]byte, error) { + json := jsoniter.ConfigCompatibleWithStandardLibrary return json.Marshal(cfg) } @@ -78,11 +84,13 @@ type IssuesConfig struct { // FromDB fills up a IssuesConfig from serialized format. func (cfg *IssuesConfig) FromDB(bs []byte) error { + json := jsoniter.ConfigCompatibleWithStandardLibrary return json.Unmarshal(bs, &cfg) } // ToDB exports a IssuesConfig to a serialized format. func (cfg *IssuesConfig) ToDB() ([]byte, error) { + json := jsoniter.ConfigCompatibleWithStandardLibrary return json.Marshal(cfg) } @@ -97,11 +105,13 @@ type PullRequestsConfig struct { // FromDB fills up a PullRequestsConfig from serialized format. func (cfg *PullRequestsConfig) FromDB(bs []byte) error { + json := jsoniter.ConfigCompatibleWithStandardLibrary return json.Unmarshal(bs, &cfg) } // ToDB exports a PullRequestsConfig to a serialized format. func (cfg *PullRequestsConfig) ToDB() ([]byte, error) { + json := jsoniter.ConfigCompatibleWithStandardLibrary return json.Marshal(cfg) } |