From d00114ba6e62f2f20e2a76af9fef4c55c7e3a312 Mon Sep 17 00:00:00 2001 From: jan Date: Sun, 13 Nov 2016 17:57:45 +0100 Subject: isSameUser funktion fuer den renderer diff --git a/charakterin.go b/charakterin.go index 413d698..525b329 100644 --- a/charakterin.go +++ b/charakterin.go @@ -50,6 +50,19 @@ type Charakterin struct { var reEmail, _ = regexp.Compile(`(\w[-._\w]*\w@\w[-._\w]*\w\.\w{2,})`) var reUsername, _ = regexp.Compile(`^(\w+( \w+)?)+$`) +func GetRendererFunctions() map[string]interface{} { + m := make(map[string]interface{}) + + m["isSameUser"] = func(u1 *User, u2 *User) bool { + if u1 == nil || u2 == nil { + return false + } + + return u1.ID == u2.ID + } + return m +} + // New erstellt eine neue Instanz von Charakterin. func New(db *sql.DB) *Charakterin { if err := db.Ping(); err != nil { -- cgit v0.10.1