fix: refs
This commit is contained in:
19
server/refs/string.go
Normal file
19
server/refs/string.go
Normal file
@@ -0,0 +1,19 @@
|
||||
package refs
|
||||
|
||||
// NewStringRef returns a reference to a string with given value
|
||||
func NewStringRef(v string) *string {
|
||||
return &v
|
||||
}
|
||||
|
||||
// StringValue returns the value of the given string ref
|
||||
func StringValue(r *string, defaultValue ...string) string {
|
||||
if r != nil {
|
||||
return *r
|
||||
}
|
||||
if len(defaultValue) > 0 {
|
||||
return defaultValue[0]
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user