|
|
|
@@ -117,16 +117,30 @@ type DatasetConfig struct { |
|
|
|
EnableDataset bool |
|
|
|
} |
|
|
|
|
|
|
|
// FromDB fills up a IssuesConfig from serialized format. |
|
|
|
// FromDB fills up a DatasetConfig from serialized format. |
|
|
|
func (cfg *DatasetConfig) FromDB(bs []byte) error { |
|
|
|
return json.Unmarshal(bs, &cfg) |
|
|
|
} |
|
|
|
|
|
|
|
// ToDB exports a IssuesConfig to a serialized format. |
|
|
|
// ToDB exports a DatasetConfig to a serialized format. |
|
|
|
func (cfg *DatasetConfig) ToDB() ([]byte, error) { |
|
|
|
return json.Marshal(cfg) |
|
|
|
} |
|
|
|
|
|
|
|
type CloudBrainConfig struct { |
|
|
|
EnableCloudBrain bool |
|
|
|
} |
|
|
|
|
|
|
|
// FromDB fills up a CloudBrainConfig from serialized format. |
|
|
|
func (cfg *CloudBrainConfig) FromDB(bs []byte) error { |
|
|
|
return json.Unmarshal(bs, &cfg) |
|
|
|
} |
|
|
|
|
|
|
|
// ToDB exports a CloudBrainConfig to a serialized format. |
|
|
|
func (cfg *CloudBrainConfig) ToDB() ([]byte, error) { |
|
|
|
return json.Marshal(cfg) |
|
|
|
} |
|
|
|
|
|
|
|
// BeforeSet is invoked from XORM before setting the value of a field of this object. |
|
|
|
func (r *RepoUnit) BeforeSet(colName string, val xorm.Cell) { |
|
|
|
switch colName { |
|
|
|
@@ -144,6 +158,8 @@ func (r *RepoUnit) BeforeSet(colName string, val xorm.Cell) { |
|
|
|
r.Config = new(IssuesConfig) |
|
|
|
case UnitTypeDatasets: |
|
|
|
r.Config = new(DatasetConfig) |
|
|
|
case UnitTypeCloudBrain: |
|
|
|
r.Config = new(CloudBrainConfig) |
|
|
|
default: |
|
|
|
panic("unrecognized repo unit type: " + com.ToStr(*val)) |
|
|
|
} |
|
|
|
|