github.com/vnforks/kid/v5@v5.22.1-0.20200408055009-b89d99c65676/model/data_retention_policy.go (about)

     1  // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
     2  // See LICENSE.txt for license information.
     3  
     4  package model
     5  
     6  import (
     7  	"encoding/json"
     8  	"io"
     9  )
    10  
    11  type DataRetentionPolicy struct {
    12  	MessageDeletionEnabled bool  `json:"message_deletion_enabled"`
    13  	FileDeletionEnabled    bool  `json:"file_deletion_enabled"`
    14  	MessageRetentionCutoff int64 `json:"message_retention_cutoff"`
    15  	FileRetentionCutoff    int64 `json:"file_retention_cutoff"`
    16  }
    17  
    18  func (me *DataRetentionPolicy) ToJson() string {
    19  	b, _ := json.Marshal(me)
    20  	return string(b)
    21  }
    22  
    23  func DataRetentionPolicyFromJson(data io.Reader) *DataRetentionPolicy {
    24  	var me *DataRetentionPolicy
    25  	json.NewDecoder(data).Decode(&me)
    26  	return me
    27  }