|
@@ -1,5 +1,6 @@
|
|
|
package session
|
|
|
|
|
|
+// IsSetString to check if variable exists
|
|
|
func (s *Session) IsSetString(name string) bool {
|
|
|
if _, ok := s.varlist.String[name]; ok {
|
|
|
return true
|
|
@@ -8,6 +9,7 @@ func (s *Session) IsSetString(name string) bool {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+// GetString returns stored variable value or default
|
|
|
func (s *Session) GetString(name string, def string) string {
|
|
|
if v, ok := s.varlist.String[name]; ok {
|
|
|
return v
|
|
@@ -16,6 +18,7 @@ func (s *Session) GetString(name string, def string) string {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+// SetString to set variable value
|
|
|
func (s *Session) SetString(name string, value string) {
|
|
|
isset := s.IsSetString(name)
|
|
|
s.varlist.String[name] = value
|
|
@@ -24,6 +27,7 @@ func (s *Session) SetString(name string, value string) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+// DelString to remove variable
|
|
|
func (s *Session) DelString(name string) {
|
|
|
if s.IsSetString(name) {
|
|
|
delete(s.varlist.String, name)
|