int.go 437 B

12345678910111213141516171819202122232425
  1. package session
  2. func (this *Session) IsSetInt(name string) bool {
  3. if _, ok := this.v.Int[name]; ok {
  4. return true
  5. } else {
  6. return false
  7. }
  8. }
  9. func (this *Session) GetInt(name string, def int) int {
  10. if v, ok := this.v.Int[name]; ok {
  11. return v
  12. } else {
  13. return def
  14. }
  15. }
  16. func (this *Session) SetInt(name string, value int) {
  17. isset := this.IsSetInt(name)
  18. this.v.Int[name] = value
  19. if isset || value != 0 {
  20. this.c = true
  21. }
  22. }