github.com/coveo/gotemplate@v2.7.7+incompatible/xml/generated_impl.go (about) 1 // This file was automatically generated by genny. 2 // Any changes will be lost if this file is regenerated. 3 // see https://github.com/cheekybits/genny 4 5 package xml 6 7 import "github.com/coveo/gotemplate/collections" 8 9 // List implementation of IGenericList for xmlList 10 type List = xmlList 11 type xmlIList = collections.IGenericList 12 type xmlList []interface{} 13 14 func (l xmlList) AsArray() []interface{} { return []interface{}(l) } 15 func (l xmlList) Cap() int { return cap(l) } 16 func (l xmlList) Capacity() int { return cap(l) } 17 func (l xmlList) Clone() xmlIList { return xmlListHelper.Clone(l) } 18 func (l xmlList) Contains(values ...interface{}) bool { 19 return xmlListHelper.Contains(l, values...) 20 } 21 func (l xmlList) Count() int { return len(l) } 22 func (l xmlList) Create(args ...int) xmlIList { return xmlListHelper.CreateList(args...) } 23 func (l xmlList) CreateDict(args ...int) xmlIDict { 24 return xmlListHelper.CreateDictionary(args...) 25 } 26 func (l xmlList) First() interface{} { return xmlListHelper.GetIndexes(l, 0) } 27 func (l xmlList) Get(indexes ...int) interface{} { 28 return xmlListHelper.GetIndexes(l, indexes...) 29 } 30 func (l xmlList) Has(values ...interface{}) bool { return l.Contains(values...) } 31 func (l xmlList) Join(sep interface{}) str { return l.StringArray().Join(sep) } 32 func (l xmlList) Last() interface{} { return xmlListHelper.GetIndexes(l, len(l)-1) } 33 func (l xmlList) Len() int { return len(l) } 34 func (l xmlList) New(args ...interface{}) xmlIList { return xmlListHelper.NewList(args...) } 35 func (l xmlList) Reverse() xmlIList { return xmlListHelper.Reverse(l) } 36 func (l xmlList) StringArray() strArray { return xmlListHelper.GetStringArray(l) } 37 func (l xmlList) Strings() []string { return xmlListHelper.GetStrings(l) } 38 func (l xmlList) TypeName() str { return "Xml" } 39 func (l xmlList) Unique() xmlIList { return xmlListHelper.Unique(l) } 40 41 func (l xmlList) GetHelpers() (collections.IDictionaryHelper, collections.IListHelper) { 42 return xmlDictHelper, xmlListHelper 43 } 44 45 func (l xmlList) Append(values ...interface{}) xmlIList { 46 return xmlListHelper.Add(l, false, values...) 47 } 48 49 func (l xmlList) Intersect(values ...interface{}) xmlIList { 50 return xmlListHelper.Intersect(l, values...) 51 } 52 53 func (l xmlList) Pop(indexes ...int) (interface{}, xmlIList) { 54 if len(indexes) == 0 { 55 indexes = []int{len(l) - 1} 56 } 57 return l.Get(indexes...), l.Remove(indexes...) 58 } 59 60 func (l xmlList) Prepend(values ...interface{}) xmlIList { 61 return xmlListHelper.Add(l, true, values...) 62 } 63 64 func (l xmlList) Remove(indexes ...int) xmlIList { 65 return xmlListHelper.Remove(l, indexes...) 66 } 67 68 func (l xmlList) Set(i int, v interface{}) (xmlIList, error) { 69 return xmlListHelper.SetIndex(l, i, v) 70 } 71 72 func (l xmlList) Union(values ...interface{}) xmlIList { 73 return xmlListHelper.Add(l, false, values...).Unique() 74 } 75 76 func (l xmlList) Without(values ...interface{}) xmlIList { 77 return xmlListHelper.Without(l, values...) 78 } 79 80 // Dictionary implementation of IDictionary for xmlDict 81 type Dictionary = xmlDict 82 type xmlIDict = collections.IDictionary 83 type xmlDict map[string]interface{} 84 85 func (d xmlDict) Add(key, v interface{}) xmlIDict { return xmlDictHelper.Add(d, key, v) } 86 func (d xmlDict) AsMap() map[string]interface{} { return (map[string]interface{})(d) } 87 func (d xmlDict) Clone(keys ...interface{}) xmlIDict { return xmlDictHelper.Clone(d, keys) } 88 func (d xmlDict) Count() int { return len(d) } 89 func (d xmlDict) Create(args ...int) xmlIDict { return xmlListHelper.CreateDictionary(args...) } 90 func (d xmlDict) CreateList(args ...int) xmlIList { return xmlHelper.CreateList(args...) } 91 func (d xmlDict) Flush(keys ...interface{}) xmlIDict { return xmlDictHelper.Flush(d, keys) } 92 func (d xmlDict) Get(keys ...interface{}) interface{} { return xmlDictHelper.Get(d, keys) } 93 func (d xmlDict) GetKeys() xmlIList { return xmlDictHelper.GetKeys(d) } 94 func (d xmlDict) GetValues() xmlIList { return xmlDictHelper.GetValues(d) } 95 func (d xmlDict) Has(keys ...interface{}) bool { return xmlDictHelper.Has(d, keys) } 96 func (d xmlDict) KeysAsString() strArray { return xmlDictHelper.KeysAsString(d) } 97 func (d xmlDict) Len() int { return len(d) } 98 func (d xmlDict) Native() interface{} { return collections.ToNativeRepresentation(d) } 99 func (d xmlDict) Pop(keys ...interface{}) interface{} { return xmlDictHelper.Pop(d, keys) } 100 func (d xmlDict) Set(key, v interface{}) xmlIDict { return xmlDictHelper.Set(d, key, v) } 101 func (d xmlDict) Transpose() xmlIDict { return xmlDictHelper.Transpose(d) } 102 func (d xmlDict) TypeName() str { return "Xml" } 103 104 func (d xmlDict) GetHelpers() (collections.IDictionaryHelper, collections.IListHelper) { 105 return xmlDictHelper, xmlListHelper 106 } 107 108 func (d xmlDict) Default(key, defVal interface{}) interface{} { 109 return xmlDictHelper.Default(d, key, defVal) 110 } 111 112 func (d xmlDict) Delete(key interface{}, otherKeys ...interface{}) (xmlIDict, error) { 113 return xmlDictHelper.Delete(d, append([]interface{}{key}, otherKeys...)) 114 } 115 116 func (d xmlDict) Merge(dict xmlIDict, otherDicts ...xmlIDict) xmlIDict { 117 return xmlDictHelper.Merge(d, append([]xmlIDict{dict}, otherDicts...)) 118 } 119 120 func (d xmlDict) Omit(key interface{}, otherKeys ...interface{}) xmlIDict { 121 return xmlDictHelper.Omit(d, append([]interface{}{key}, otherKeys...)) 122 } 123 124 // Generic helpers to simplify physical implementation 125 func xmlListConvert(list xmlIList) xmlIList { return xmlList(list.AsArray()) } 126 func xmlDictConvert(dict xmlIDict) xmlIDict { return xmlDict(dict.AsMap()) } 127 func needConversion(object interface{}, strict bool) bool { 128 return needConversionImpl(object, strict, "Xml") 129 } 130 131 var xmlHelper = helperBase{ConvertList: xmlListConvert, ConvertDict: xmlDictConvert, NeedConversion: needConversion} 132 var xmlListHelper = helperList{BaseHelper: xmlHelper} 133 var xmlDictHelper = helperDict{BaseHelper: xmlHelper} 134 135 // DictionaryHelper gives public access to the basic dictionary functions 136 var DictionaryHelper collections.IDictionaryHelper = xmlDictHelper 137 138 // GenericListHelper gives public access to the basic list functions 139 var GenericListHelper collections.IListHelper = xmlListHelper 140 141 type ( 142 str = collections.String 143 strArray = collections.StringArray 144 ) 145 146 var iif = collections.IIf