1// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. 2// See LICENSE.txt for license information. 3 4package plugin 5 6import ( 7 "fmt" 8) 9 10func stringify(objects []interface{}) []string { 11 stringified := make([]string, len(objects)) 12 for i, object := range objects { 13 stringified[i] = fmt.Sprintf("%+v", object) 14 } 15 return stringified 16} 17 18func toObjects(strings []string) []interface{} { 19 if strings == nil { 20 return nil 21 } 22 objects := make([]interface{}, len(strings)) 23 for i, string := range strings { 24 objects[i] = string 25 } 26 return objects 27} 28 29func stringifyToObjects(objects []interface{}) []interface{} { 30 return toObjects(stringify(objects)) 31} 32