aboutsummaryrefslogtreecommitdiff
path: root/string_array.go
diff options
context:
space:
mode:
authortherealmitchconnors <[email protected]>2019-09-05 11:27:43 -0700
committertherealmitchconnors <[email protected]>2019-09-05 11:27:43 -0700
commitb22fc706c39eab8ef626dad18f21609425cc8714 (patch)
tree324d2c8c6d112bf4f9e44db15c760831cfb9347d /string_array.go
parentc6c0f0fd30b9b96d1c9a1cbf90799706bd501458 (diff)
Expand SliceValue support to all slice and array types.
Diffstat (limited to 'string_array.go')
-rw-r--r--string_array.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/string_array.go b/string_array.go
index fa7bc60..4894af8 100644
--- a/string_array.go
+++ b/string_array.go
@@ -23,6 +23,32 @@ func (s *stringArrayValue) Set(val string) error {
return nil
}
+func (s *stringArrayValue) Append(val string) error {
+ *s.value = append(*s.value, val)
+ return nil
+}
+
+func (s *stringArrayValue) Replace(val []string) error {
+ out := make([]string, len(val))
+ for i, d := range val {
+ var err error
+ out[i] = d
+ if err != nil {
+ return err
+ }
+ }
+ *s.value = out
+ return nil
+}
+
+func (s *stringArrayValue) GetSlice() []string {
+ out := make([]string, len(*s.value))
+ for i, d := range *s.value {
+ out[i] = d
+ }
+ return out
+}
+
func (s *stringArrayValue) Type() string {
return "stringArray"
}