Skip to content
Snippets Groups Projects
Commit b6608cd3 authored by Johan de Klerk's avatar Johan de Klerk
Browse files

Verify audit event types

parent 24c633d0
No related branches found
No related tags found
No related merge requests found
......@@ -2,6 +2,7 @@ package audit
import (
"encoding/json"
"gitlab.com/uafrica/go-utils/errors"
"reflect"
"regexp"
"strconv"
......@@ -17,6 +18,19 @@ type FieldChange struct {
To interface{} `json:"change_to"`
}
func VerifyAuditEvents(original interface{}, new interface{}) error {
structValue := reflect.ValueOf(original)
if structValue.Kind() != reflect.Struct {
return errors.New("original object is not of type struct")
}
structValue = reflect.ValueOf(new)
if structValue.Kind() != reflect.Struct {
return errors.New("new object is not of type struct")
}
return nil
}
func GetChanges(original interface{}, new interface{}) (map[string]interface{}, error) {
changes := map[string]interface{}{}
changelog, err := diff.Diff(original, new)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment