2019-11-23 03:52:29 +00:00
|
|
|
package yqlib
|
2015-10-01 23:05:13 +00:00
|
|
|
|
|
|
|
import (
|
2017-09-22 19:58:12 +00:00
|
|
|
"fmt"
|
2019-04-30 22:40:35 +00:00
|
|
|
"reflect"
|
2015-10-01 23:05:13 +00:00
|
|
|
"strconv"
|
2019-05-12 23:32:08 +00:00
|
|
|
"strings"
|
2017-09-20 23:40:33 +00:00
|
|
|
|
2019-09-03 05:52:55 +00:00
|
|
|
yaml "github.com/mikefarah/yaml/v2"
|
2019-12-01 19:44:44 +00:00
|
|
|
logging "gopkg.in/op/go-logging.v1"
|
2015-10-01 23:05:13 +00:00
|
|
|
)
|
|
|
|
|
2019-12-01 19:44:44 +00:00
|
|
|
type DataNavigator interface {
|
|
|
|
ReadChildValue(child interface{}, remainingPaths []string) (interface{}, error)
|
|
|
|
UpdatedChildValue(child interface{}, remainingPaths []string, value interface{}) interface{}
|
|
|
|
DeleteChildValue(child interface{}, remainingPaths []string) (interface{}, error)
|
|
|
|
}
|
|
|
|
|
|
|
|
type navigator struct {
|
|
|
|
log *logging.Logger
|
|
|
|
}
|
|
|
|
|
|
|
|
func NewDataNavigator(l *logging.Logger) DataNavigator {
|
|
|
|
return &navigator {
|
|
|
|
log: l,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (n *navigator) ReadChildValue(child interface{}, remainingPaths []string) (interface{}, error) {
|
|
|
|
if len(remainingPaths) == 0 {
|
|
|
|
return child, nil
|
|
|
|
}
|
|
|
|
return n.recurse(child, remainingPaths[0], remainingPaths[1:])
|
|
|
|
}
|
|
|
|
|
|
|
|
func (n *navigator) UpdatedChildValue(child interface{}, remainingPaths []string, value interface{}) interface{} {
|
|
|
|
if len(remainingPaths) == 0 {
|
|
|
|
return value
|
|
|
|
}
|
|
|
|
n.log.Debugf("UpdatedChildValue for child %v with path %v to set value %v", child, remainingPaths, value)
|
|
|
|
n.log.Debugf("type of child is %v", reflect.TypeOf(child))
|
|
|
|
|
|
|
|
switch child := child.(type) {
|
|
|
|
case nil:
|
|
|
|
if remainingPaths[0] == "+" || remainingPaths[0] == "*" {
|
|
|
|
return n.writeArray(child, remainingPaths, value)
|
|
|
|
}
|
|
|
|
case []interface{}:
|
|
|
|
_, nextIndexErr := strconv.ParseInt(remainingPaths[0], 10, 64)
|
|
|
|
arrayCommand := nextIndexErr == nil || remainingPaths[0] == "+" || remainingPaths[0] == "*"
|
|
|
|
if arrayCommand {
|
|
|
|
return n.writeArray(child, remainingPaths, value)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return n.writeMap(child, remainingPaths, value)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (n *navigator) DeleteChildValue(child interface{}, remainingPaths []string) (interface{}, error) {
|
|
|
|
n.log.Debugf("DeleteChildValue for %v for %v\n", remainingPaths, child)
|
|
|
|
if len(remainingPaths) == 0 {
|
|
|
|
return child, nil
|
|
|
|
}
|
|
|
|
var head = remainingPaths[0]
|
|
|
|
var tail = remainingPaths[1:]
|
|
|
|
switch child := child.(type) {
|
|
|
|
case yaml.MapSlice:
|
|
|
|
return n.deleteMap(child, remainingPaths)
|
|
|
|
case []interface{}:
|
|
|
|
if head == "*" {
|
|
|
|
return n.deleteArraySplat(child, tail)
|
|
|
|
}
|
|
|
|
index, err := strconv.ParseInt(head, 10, 64)
|
|
|
|
if err != nil {
|
|
|
|
return nil, fmt.Errorf("error accessing array: %v", err)
|
|
|
|
}
|
|
|
|
return n.deleteArray(child, remainingPaths, index)
|
|
|
|
}
|
|
|
|
return child, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (n *navigator) recurse(value interface{}, head string, tail []string) (interface{}, error) {
|
|
|
|
switch value := value.(type) {
|
|
|
|
case []interface{}:
|
|
|
|
if head == "*" {
|
|
|
|
return n.readArraySplat(value, tail)
|
|
|
|
}
|
|
|
|
index, err := strconv.ParseInt(head, 10, 64)
|
|
|
|
if err != nil {
|
|
|
|
return nil, fmt.Errorf("error accessing array: %v", err)
|
|
|
|
}
|
|
|
|
return n.readArray(value, index, tail)
|
|
|
|
case yaml.MapSlice:
|
|
|
|
return n.readMap(value, head, tail)
|
|
|
|
default:
|
|
|
|
return nil, nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (n *navigator) matchesKey(key string, actual interface{}) bool {
|
2019-05-12 23:32:08 +00:00
|
|
|
var actualString = fmt.Sprintf("%v", actual)
|
|
|
|
var prefixMatch = strings.TrimSuffix(key, "*")
|
|
|
|
if prefixMatch != key {
|
|
|
|
return strings.HasPrefix(actualString, prefixMatch)
|
|
|
|
}
|
|
|
|
return actualString == key
|
|
|
|
}
|
|
|
|
|
2019-12-01 19:44:44 +00:00
|
|
|
func (n *navigator) entriesInSlice(context yaml.MapSlice, key string) []*yaml.MapItem {
|
2019-05-12 23:13:45 +00:00
|
|
|
var matches = make([]*yaml.MapItem, 0)
|
2017-02-26 22:01:52 +00:00
|
|
|
for idx := range context {
|
|
|
|
var entry = &context[idx]
|
2019-12-01 19:44:44 +00:00
|
|
|
if n.matchesKey(key, entry.Key) {
|
2019-05-12 23:13:45 +00:00
|
|
|
matches = append(matches, entry)
|
2017-02-26 22:01:52 +00:00
|
|
|
}
|
|
|
|
}
|
2019-05-12 23:13:45 +00:00
|
|
|
return matches
|
2017-02-26 22:01:52 +00:00
|
|
|
}
|
|
|
|
|
2019-12-01 19:44:44 +00:00
|
|
|
func (n *navigator) getMapSlice(context interface{}) yaml.MapSlice {
|
2017-04-11 23:16:54 +00:00
|
|
|
var mapSlice yaml.MapSlice
|
2019-01-20 22:33:14 +00:00
|
|
|
switch context := context.(type) {
|
2017-04-11 23:16:54 +00:00
|
|
|
case yaml.MapSlice:
|
2019-01-20 22:33:14 +00:00
|
|
|
mapSlice = context
|
2017-04-11 23:16:54 +00:00
|
|
|
default:
|
|
|
|
mapSlice = make(yaml.MapSlice, 0)
|
|
|
|
}
|
2018-05-04 15:46:58 +00:00
|
|
|
return mapSlice
|
|
|
|
}
|
|
|
|
|
2019-12-01 19:44:44 +00:00
|
|
|
func (n *navigator) getArray(context interface{}) (array []interface{}, ok bool) {
|
2019-01-20 22:33:14 +00:00
|
|
|
switch context := context.(type) {
|
2018-05-04 15:46:58 +00:00
|
|
|
case []interface{}:
|
2019-01-20 22:33:14 +00:00
|
|
|
array = context
|
2018-05-04 15:46:58 +00:00
|
|
|
ok = true
|
|
|
|
default:
|
|
|
|
array = make([]interface{}, 0)
|
|
|
|
ok = false
|
|
|
|
}
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2019-12-01 19:44:44 +00:00
|
|
|
func (n *navigator) writeMap(context interface{}, paths []string, value interface{}) interface{} {
|
|
|
|
n.log.Debugf("writeMap with path %v for %v to set value %v\n", paths, context, value)
|
2018-05-04 15:46:58 +00:00
|
|
|
|
2019-12-01 19:44:44 +00:00
|
|
|
mapSlice := n.getMapSlice(context)
|
2017-04-11 23:16:54 +00:00
|
|
|
|
|
|
|
if len(paths) == 0 {
|
2019-05-12 23:13:45 +00:00
|
|
|
return context
|
2017-04-11 23:16:54 +00:00
|
|
|
}
|
|
|
|
|
2019-12-01 19:44:44 +00:00
|
|
|
children := n.entriesInSlice(mapSlice, paths[0])
|
2019-05-12 23:13:45 +00:00
|
|
|
|
|
|
|
if len(children) == 0 && paths[0] == "*" {
|
2019-12-01 19:44:44 +00:00
|
|
|
n.log.Debugf("\tNo matches, return map as is")
|
2019-05-12 23:13:45 +00:00
|
|
|
return context
|
|
|
|
}
|
|
|
|
|
|
|
|
if len(children) == 0 {
|
2017-04-11 23:16:54 +00:00
|
|
|
newChild := yaml.MapItem{Key: paths[0]}
|
|
|
|
mapSlice = append(mapSlice, newChild)
|
2019-12-01 19:44:44 +00:00
|
|
|
children = n.entriesInSlice(mapSlice, paths[0])
|
|
|
|
n.log.Debugf("\tAppended child at %v for mapSlice %v\n", paths[0], mapSlice)
|
2017-04-11 23:16:54 +00:00
|
|
|
}
|
|
|
|
|
2017-09-20 23:40:33 +00:00
|
|
|
remainingPaths := paths[1:]
|
2019-05-12 23:13:45 +00:00
|
|
|
for _, child := range children {
|
2019-12-01 19:44:44 +00:00
|
|
|
child.Value = n.UpdatedChildValue(child.Value, remainingPaths, value)
|
2019-05-12 23:13:45 +00:00
|
|
|
}
|
2019-12-01 19:44:44 +00:00
|
|
|
n.log.Debugf("\tReturning mapSlice %v\n", mapSlice)
|
2017-04-11 23:16:54 +00:00
|
|
|
return mapSlice
|
|
|
|
}
|
|
|
|
|
2019-12-01 19:44:44 +00:00
|
|
|
func (n *navigator) writeArray(context interface{}, paths []string, value interface{}) []interface{} {
|
|
|
|
n.log.Debugf("writeArray with path %v for %v to set value %v\n", paths, context, value)
|
|
|
|
array, _ := n.getArray(context)
|
2017-04-11 23:16:54 +00:00
|
|
|
|
|
|
|
if len(paths) == 0 {
|
|
|
|
return array
|
|
|
|
}
|
|
|
|
|
2019-12-01 19:44:44 +00:00
|
|
|
n.log.Debugf("\tarray %v\n", array)
|
2017-04-11 23:16:54 +00:00
|
|
|
|
|
|
|
rawIndex := paths[0]
|
2019-04-30 22:49:50 +00:00
|
|
|
remainingPaths := paths[1:]
|
2017-09-24 00:21:16 +00:00
|
|
|
var index int64
|
|
|
|
// the append array indicator
|
|
|
|
if rawIndex == "+" {
|
|
|
|
index = int64(len(array))
|
2019-04-30 22:49:50 +00:00
|
|
|
} else if rawIndex == "*" {
|
|
|
|
for index, oldChild := range array {
|
2019-12-01 19:44:44 +00:00
|
|
|
array[index] = n.UpdatedChildValue(oldChild, remainingPaths, value)
|
2019-04-30 22:49:50 +00:00
|
|
|
}
|
|
|
|
return array
|
2017-09-24 00:21:16 +00:00
|
|
|
} else {
|
2018-08-06 06:24:06 +00:00
|
|
|
index, _ = strconv.ParseInt(rawIndex, 10, 64) // nolint
|
2019-11-23 03:52:29 +00:00
|
|
|
// writeArray is only called by UpdatedChildValue which handles parsing the
|
2018-08-06 06:24:06 +00:00
|
|
|
// index, as such this renders this dead code.
|
2017-09-24 00:21:16 +00:00
|
|
|
}
|
2018-08-06 06:24:06 +00:00
|
|
|
|
2017-04-17 22:53:27 +00:00
|
|
|
for index >= int64(len(array)) {
|
|
|
|
array = append(array, nil)
|
|
|
|
}
|
2017-04-11 23:16:54 +00:00
|
|
|
currentChild := array[index]
|
|
|
|
|
2019-12-01 19:44:44 +00:00
|
|
|
n.log.Debugf("\tcurrentChild %v\n", currentChild)
|
2017-04-11 23:16:54 +00:00
|
|
|
|
2019-12-01 19:44:44 +00:00
|
|
|
array[index] = n.UpdatedChildValue(currentChild, remainingPaths, value)
|
|
|
|
n.log.Debugf("\tReturning array %v\n", array)
|
2017-04-11 23:16:54 +00:00
|
|
|
return array
|
2015-10-01 23:05:13 +00:00
|
|
|
}
|
|
|
|
|
2019-12-01 19:44:44 +00:00
|
|
|
func (n *navigator) readMap(context yaml.MapSlice, head string, tail []string) (interface{}, error) {
|
|
|
|
n.log.Debugf("readingMap %v with key %v\n", context, head)
|
2015-10-05 23:01:33 +00:00
|
|
|
if head == "*" {
|
2019-12-01 19:44:44 +00:00
|
|
|
return n.readMapSplat(context, tail)
|
2015-10-05 23:01:33 +00:00
|
|
|
}
|
2017-04-11 23:16:54 +00:00
|
|
|
|
2019-12-01 19:44:44 +00:00
|
|
|
entries := n.entriesInSlice(context, head)
|
2019-05-12 23:13:45 +00:00
|
|
|
if len(entries) == 1 {
|
2019-12-01 19:44:44 +00:00
|
|
|
return n.calculateValue(entries[0].Value, tail)
|
2019-05-12 23:13:45 +00:00
|
|
|
} else if len(entries) == 0 {
|
|
|
|
return nil, nil
|
|
|
|
}
|
|
|
|
var errInIdx error
|
|
|
|
values := make([]interface{}, len(entries))
|
|
|
|
for idx, entry := range entries {
|
2019-12-01 19:44:44 +00:00
|
|
|
values[idx], errInIdx = n.calculateValue(entry.Value, tail)
|
2019-05-12 23:13:45 +00:00
|
|
|
if errInIdx != nil {
|
2019-12-01 19:44:44 +00:00
|
|
|
n.log.Errorf("Error updating index %v in %v", idx, context)
|
2019-05-12 23:13:45 +00:00
|
|
|
return nil, errInIdx
|
|
|
|
}
|
|
|
|
|
2017-02-26 22:01:52 +00:00
|
|
|
}
|
2019-05-12 23:13:45 +00:00
|
|
|
return values, nil
|
2015-10-01 23:05:13 +00:00
|
|
|
}
|
|
|
|
|
2019-12-01 19:44:44 +00:00
|
|
|
func (n *navigator) readMapSplat(context yaml.MapSlice, tail []string) (interface{}, error) {
|
2015-10-05 23:01:33 +00:00
|
|
|
var newArray = make([]interface{}, len(context))
|
|
|
|
var i = 0
|
2017-02-26 22:01:52 +00:00
|
|
|
for _, entry := range context {
|
2015-10-05 23:01:33 +00:00
|
|
|
if len(tail) > 0 {
|
2019-12-01 19:44:44 +00:00
|
|
|
val, err := n.recurse(entry.Value, tail[0], tail[1:])
|
2017-09-22 19:58:12 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
newArray[i] = val
|
2015-10-05 23:01:33 +00:00
|
|
|
} else {
|
2017-02-26 22:01:52 +00:00
|
|
|
newArray[i] = entry.Value
|
2015-10-05 23:01:33 +00:00
|
|
|
}
|
|
|
|
i++
|
|
|
|
}
|
2017-09-22 19:58:12 +00:00
|
|
|
return newArray, nil
|
2015-10-05 23:01:33 +00:00
|
|
|
}
|
|
|
|
|
2019-12-01 19:44:44 +00:00
|
|
|
func (n *navigator) readArray(array []interface{}, head int64, tail []string) (interface{}, error) {
|
2016-03-16 05:11:06 +00:00
|
|
|
if head >= int64(len(array)) {
|
2017-09-22 19:58:12 +00:00
|
|
|
return nil, nil
|
2015-10-03 06:50:36 +00:00
|
|
|
}
|
|
|
|
|
2015-10-01 23:05:13 +00:00
|
|
|
value := array[head]
|
2019-12-01 19:44:44 +00:00
|
|
|
return n.calculateValue(value, tail)
|
2015-10-01 23:05:13 +00:00
|
|
|
}
|
2015-10-05 03:41:01 +00:00
|
|
|
|
2019-12-01 19:44:44 +00:00
|
|
|
func (n *navigator) readArraySplat(array []interface{}, tail []string) (interface{}, error) {
|
2015-10-05 03:41:01 +00:00
|
|
|
var newArray = make([]interface{}, len(array))
|
|
|
|
for index, value := range array {
|
2019-12-01 19:44:44 +00:00
|
|
|
val, err := n.calculateValue(value, tail)
|
2017-09-22 19:58:12 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
newArray[index] = val
|
2015-10-05 03:41:01 +00:00
|
|
|
}
|
2017-09-22 19:58:12 +00:00
|
|
|
return newArray, nil
|
2015-10-05 03:41:01 +00:00
|
|
|
}
|
|
|
|
|
2019-12-01 19:44:44 +00:00
|
|
|
func (n *navigator) calculateValue(value interface{}, tail []string) (interface{}, error) {
|
2015-10-05 03:41:01 +00:00
|
|
|
if len(tail) > 0 {
|
2019-12-01 19:44:44 +00:00
|
|
|
return n.recurse(value, tail[0], tail[1:])
|
2015-10-05 03:41:01 +00:00
|
|
|
}
|
2017-09-22 19:58:12 +00:00
|
|
|
return value, nil
|
2015-10-05 03:41:01 +00:00
|
|
|
}
|
2017-09-23 03:29:37 +00:00
|
|
|
|
2019-12-01 19:44:44 +00:00
|
|
|
func (n *navigator) deleteMap(context interface{}, paths []string) (yaml.MapSlice, error) {
|
|
|
|
n.log.Debugf("deleteMap for %v for %v\n", paths, context)
|
2018-05-04 15:46:58 +00:00
|
|
|
|
2019-12-01 19:44:44 +00:00
|
|
|
mapSlice := n.getMapSlice(context)
|
2018-05-04 15:46:58 +00:00
|
|
|
|
|
|
|
if len(paths) == 0 {
|
2019-05-14 01:20:41 +00:00
|
|
|
return mapSlice, nil
|
2018-05-04 15:46:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
var index int
|
|
|
|
var child yaml.MapItem
|
|
|
|
for index, child = range mapSlice {
|
2019-12-01 19:44:44 +00:00
|
|
|
if n.matchesKey(paths[0], child.Key) {
|
|
|
|
n.log.Debugf("\tMatched [%v] with [%v] at index %v", paths[0], child.Key, index)
|
2019-05-14 01:20:41 +00:00
|
|
|
var badDelete error
|
2019-12-01 19:44:44 +00:00
|
|
|
mapSlice, badDelete = n.deleteEntryInMap(mapSlice, child, index, paths)
|
2019-05-14 01:20:41 +00:00
|
|
|
if badDelete != nil {
|
|
|
|
return nil, badDelete
|
|
|
|
}
|
2018-05-04 15:46:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-05-14 01:20:41 +00:00
|
|
|
return mapSlice, nil
|
2018-05-04 15:46:58 +00:00
|
|
|
|
2019-05-12 23:48:05 +00:00
|
|
|
}
|
|
|
|
|
2019-12-01 19:44:44 +00:00
|
|
|
func (n *navigator) deleteEntryInMap(original yaml.MapSlice, child yaml.MapItem, index int, paths []string) (yaml.MapSlice, error) {
|
2018-05-04 15:46:58 +00:00
|
|
|
remainingPaths := paths[1:]
|
|
|
|
|
|
|
|
var newSlice yaml.MapSlice
|
|
|
|
if len(remainingPaths) > 0 {
|
|
|
|
newChild := yaml.MapItem{Key: child.Key}
|
2019-05-14 01:20:41 +00:00
|
|
|
var errorDeleting error
|
2019-12-01 19:44:44 +00:00
|
|
|
newChild.Value, errorDeleting = n.DeleteChildValue(child.Value, remainingPaths)
|
2019-05-14 01:20:41 +00:00
|
|
|
if errorDeleting != nil {
|
|
|
|
return nil, errorDeleting
|
|
|
|
}
|
2018-05-04 15:46:58 +00:00
|
|
|
|
2019-05-12 23:48:05 +00:00
|
|
|
newSlice = make(yaml.MapSlice, len(original))
|
|
|
|
for i := range original {
|
|
|
|
item := original[i]
|
2018-05-04 15:46:58 +00:00
|
|
|
if i == index {
|
|
|
|
item = newChild
|
|
|
|
}
|
|
|
|
newSlice[i] = item
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// Delete item from slice at index
|
2019-05-12 23:48:05 +00:00
|
|
|
newSlice = append(original[:index], original[index+1:]...)
|
2019-12-01 19:44:44 +00:00
|
|
|
n.log.Debugf("\tDeleted item index %d from original", index)
|
2018-05-04 15:46:58 +00:00
|
|
|
}
|
|
|
|
|
2019-12-01 19:44:44 +00:00
|
|
|
n.log.Debugf("\tReturning original %v\n", original)
|
2019-05-14 01:20:41 +00:00
|
|
|
return newSlice, nil
|
2018-05-04 15:46:58 +00:00
|
|
|
}
|
|
|
|
|
2019-12-01 19:44:44 +00:00
|
|
|
func (n *navigator) deleteArraySplat(array []interface{}, tail []string) (interface{}, error) {
|
|
|
|
n.log.Debugf("deleteArraySplat for %v for %v\n", tail, array)
|
2019-05-14 01:20:41 +00:00
|
|
|
var newArray = make([]interface{}, len(array))
|
|
|
|
for index, value := range array {
|
2019-12-01 19:44:44 +00:00
|
|
|
val, err := n.DeleteChildValue(value, tail)
|
2019-05-14 01:20:41 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
newArray[index] = val
|
2018-05-04 15:46:58 +00:00
|
|
|
}
|
2019-05-14 01:20:41 +00:00
|
|
|
return newArray, nil
|
|
|
|
}
|
|
|
|
|
2019-12-01 19:44:44 +00:00
|
|
|
func (n *navigator) deleteArray(array []interface{}, paths []string, index int64) (interface{}, error) {
|
|
|
|
n.log.Debugf("deleteArray for %v for %v\n", paths, array)
|
2018-05-04 15:46:58 +00:00
|
|
|
|
|
|
|
if index >= int64(len(array)) {
|
2019-05-14 01:20:41 +00:00
|
|
|
return array, nil
|
2018-05-04 15:46:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
remainingPaths := paths[1:]
|
|
|
|
if len(remainingPaths) > 0 {
|
2019-12-01 19:44:44 +00:00
|
|
|
// recurse into the array element at index
|
2019-05-14 01:20:41 +00:00
|
|
|
var errorDeleting error
|
2019-12-01 19:44:44 +00:00
|
|
|
array[index], errorDeleting = n.deleteMap(array[index], remainingPaths)
|
2019-05-14 01:20:41 +00:00
|
|
|
if errorDeleting != nil {
|
|
|
|
return nil, errorDeleting
|
|
|
|
}
|
|
|
|
|
2018-05-04 15:46:58 +00:00
|
|
|
} else {
|
|
|
|
// Delete the array element at index
|
|
|
|
array = append(array[:index], array[index+1:]...)
|
2019-12-01 19:44:44 +00:00
|
|
|
n.log.Debugf("\tDeleted item index %d from array, leaving %v", index, array)
|
2018-05-04 15:46:58 +00:00
|
|
|
}
|
|
|
|
|
2019-12-01 19:44:44 +00:00
|
|
|
n.log.Debugf("\tReturning array: %v\n", array)
|
2019-05-14 01:20:41 +00:00
|
|
|
return array, nil
|
2018-05-04 15:46:58 +00:00
|
|
|
}
|