aboutsummaryrefslogtreecommitdiff
path: root/string_slice.go
diff options
context:
space:
mode:
authorMitch Connors <[email protected]>2019-09-17 09:43:30 -0700
committerGitHub <[email protected]>2019-09-17 09:43:30 -0700
commit7b22f689a41a1727c42eb02aaa1492d26402c592 (patch)
treeca8ae6c13649d5a76f09cd8c7a4ca5011c870c85 /string_slice.go
parent972238283c0625cf3e881de7699ba8f2524c340a (diff)
parent8e39cc44d9bd06ee2d9ef3109c93809072d5e551 (diff)
Merge pull request #216 from therealmitchconnors/elegant
Implement SliceValue for better list semantics
Diffstat (limited to 'string_slice.go')
-rw-r--r--string_slice.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/string_slice.go b/string_slice.go
index b816ca8..3cb2e69 100644
--- a/string_slice.go
+++ b/string_slice.go
@@ -62,6 +62,20 @@ func (s *stringSliceValue) String() string {
return "[" + str + "]"
}
+func (s *stringSliceValue) Append(val string) error {
+ *s.value = append(*s.value, val)
+ return nil
+}
+
+func (s *stringSliceValue) Replace(val []string) error {
+ *s.value = val
+ return nil
+}
+
+func (s *stringSliceValue) GetSlice() []string {
+ return *s.value
+}
+
func stringSliceConv(sval string) (interface{}, error) {
sval = sval[1 : len(sval)-1]
// An empty string would cause a slice with one (empty) string