mirror of https://github.com/containrrr/watchtower
				
				
				
			
			You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
	
	
		
			30 lines
		
	
	
		
			556 B
		
	
	
	
		
			Go
		
	
			
		
		
	
	
			30 lines
		
	
	
		
			556 B
		
	
	
	
		
			Go
		
	
package notifications
 | 
						|
 | 
						|
import (
 | 
						|
	"encoding/json"
 | 
						|
)
 | 
						|
 | 
						|
type jsonMap = map[string]interface{}
 | 
						|
 | 
						|
// MarshalJSON implements json.Marshaler
 | 
						|
func (d Data) MarshalJSON() ([]byte, error) {
 | 
						|
	var entries = make([]jsonMap, len(d.Entries))
 | 
						|
	for i, entry := range d.Entries {
 | 
						|
		entries[i] = jsonMap{
 | 
						|
			`level`:   entry.Level,
 | 
						|
			`message`: entry.Message,
 | 
						|
			`data`:    entry.Data,
 | 
						|
			`time`:    entry.Time,
 | 
						|
		}
 | 
						|
	}
 | 
						|
 | 
						|
	return json.Marshal(jsonMap{
 | 
						|
		`report`:  d.Report,
 | 
						|
		`title`:   d.Title,
 | 
						|
		`host`:    d.Host,
 | 
						|
		`entries`: entries,
 | 
						|
	})
 | 
						|
}
 | 
						|
 | 
						|
var _ json.Marshaler = &Data{}
 |