github.com/cjdelisle/matterfoss@v5.11.1+incompatible/model/audit.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 Audit struct {
    12  	Id        string `json:"id"`
    13  	CreateAt  int64  `json:"create_at"`
    14  	UserId    string `json:"user_id"`
    15  	Action    string `json:"action"`
    16  	ExtraInfo string `json:"extra_info"`
    17  	IpAddress string `json:"ip_address"`
    18  	SessionId string `json:"session_id"`
    19  }
    20  
    21  func (o *Audit) ToJson() string {
    22  	b, _ := json.Marshal(o)
    23  	return string(b)
    24  }
    25  
    26  func AuditFromJson(data io.Reader) *Audit {
    27  	var o *Audit
    28  	json.NewDecoder(data).Decode(&o)
    29  	return o
    30  }