From a96fe4c6f8d604ae38dbed4bdc6d30fc878ff60e Mon Sep 17 00:00:00 2001 From: Gregory Boddin Date: Mon, 15 Feb 2021 03:50:40 +0100 Subject: [PATCH] Added tag helpers --- l9helper.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/l9helper.go b/l9helper.go index 75b1cd1..cd6fb0c 100644 --- a/l9helper.go +++ b/l9helper.go @@ -2,6 +2,21 @@ package l9format import "strings" +func (event *L9Event) HasTag(tag string) bool { + for _, eventTag := range event.Tags { + if eventTag == tag { + return true + } + } + return false +} + +func (event *L9Event) AddTag(tag string) { + if !event.HasTag(tag) { + event.Tags = append(event.Tags, tag) + } +} + func (event *L9Event) RemoveTransport(transportCheck string) { transports := event.Transports event.Transports = []string{}