mirror of
https://github.com/mattermost/mattermost.git
synced 2026-02-18 01:58:49 -05:00
- Add stringutils with method that "stringify" object slices - "stringify" means convert each object to its string representation - Move plugin.Log* implementations to client_rpc, use stringify method before calling server method - Exclude Log* methods from generated RPC methods - No signature change for plugin.Log* API - Add test in plugin_api_test to use plugin.Log* methods with RPC
31 lines
675 B
Go
31 lines
675 B
Go
// Copyright (c) 2019-present Mattermost, Inc. All Rights Reserved.
|
|
// See License.txt for license information.
|
|
|
|
package plugin
|
|
|
|
import (
|
|
"fmt"
|
|
)
|
|
|
|
func stringify(objects []interface{}) []string {
|
|
stringified := make([]string, len(objects), len(objects))
|
|
for i, object := range objects {
|
|
stringified[i] = fmt.Sprintf("%+v", object)
|
|
}
|
|
return stringified
|
|
}
|
|
|
|
func toObjects(strings []string) []interface{} {
|
|
if strings == nil {
|
|
return nil
|
|
}
|
|
objects := make([]interface{}, len(strings))
|
|
for i, string := range strings {
|
|
objects[i] = string
|
|
}
|
|
return objects
|
|
}
|
|
|
|
func stringifyToObjects(objects []interface{}) []interface{} {
|
|
return toObjects(stringify(objects))
|
|
}
|