2012-12-11 01:59:23 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2014-11-09 19:51:10 +00:00
|
|
|
"strings"
|
2012-12-11 01:59:23 +00:00
|
|
|
)
|
|
|
|
|
2018-12-20 09:30:42 +00:00
|
|
|
// StringArray is a type alias for a slice of strings
|
2012-12-11 01:59:23 +00:00
|
|
|
type StringArray []string
|
|
|
|
|
2019-03-20 13:58:14 +00:00
|
|
|
// Get returns the slice of strings
|
|
|
|
func (a *StringArray) Get() interface{} {
|
|
|
|
return []string(*a)
|
|
|
|
}
|
|
|
|
|
2018-12-20 09:30:42 +00:00
|
|
|
// Set appends a string to the StringArray
|
2012-12-11 01:59:23 +00:00
|
|
|
func (a *StringArray) Set(s string) error {
|
|
|
|
*a = append(*a, s)
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2018-12-20 09:30:42 +00:00
|
|
|
// String joins elements of the StringArray into a single comma separated string
|
2012-12-11 01:59:23 +00:00
|
|
|
func (a *StringArray) String() string {
|
2014-11-09 19:51:10 +00:00
|
|
|
return strings.Join(*a, ",")
|
2012-12-11 01:59:23 +00:00
|
|
|
}
|