Skip to content

Commit

Permalink
events: hash now includes "description" - 2 ( #17)
Browse files Browse the repository at this point in the history
  • Loading branch information
shadyabhi committed Oct 24, 2023
1 parent d98e383 commit d79b92f
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions calendar/gcal/event.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package gcal

import (
"bytes"
"crypto/md5"
"encoding/hex"

googlecalendar "google.golang.org/api/calendar/v3"
)

// Event is the local-representation of googlecalendar.Event
type Event struct {
*googlecalendar.Event
}

func (e Event) Hash() string {
var buffer bytes.Buffer
buffer.WriteString(e.Summary)
buffer.WriteString(e.Start.DateTime)
buffer.WriteString(e.End.DateTime)
buffer.WriteString(e.Description)

md5sum := md5.Sum(buffer.Bytes())
return hex.EncodeToString(md5sum[:])
}

0 comments on commit d79b92f

Please sign in to comment.